If you are an unexperienced programmer, I recommend to write everything into one file, say work.cpp. This is then compiled with
{}
g++ work.cpp
and executed with
{}
./a.out
You need at least g++ version 2.96; the version number can be found out by the command g++ -v.
You should put the following lines at the beginning of work.cpp:
{}
#include <assert.h> // assert macro; see ``man assert''
#include <iostream> // cin/cout
#include <math.h>
#include <stdlib.h>
If you are using a Microsoft compiler, the following may help:
{}
#if _MSC_VER > 1020 // if VC++ version is > 4.2
using namespace std; // std c++ libs implemented in std
#endif
The following should print ``hello world'' once:
{}
// put above headers here
int main() {
cout << "hello world" << endl ;
return 0 ;
}