C++
GNU C++
Installation
Ubuntu
apt install g++
AlmaLinux
dnf install gcc-c++
Examples
Fibonacci Numbers
// fibonacci Numbers
#include <iostream>
#include <cstdlib>
using namespace std;
int fib(int n)
{
if (n < 2) {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
int main(int argc, char** argv)
{
int n;
n = atoi(argv[1]);
cout << fib(n) << endl;
return 0;
}
/*
example
compile:
g++ -o fib_cpp -O3 -mtune=native fibonacci.cpp
run:
./fib_cpp 39
*/