Create a file with .cc as suffix, e.g., mine.cc and place in it the following C++ program.
// this is a comment
#include <iostream> // bring in I/O library
using namespace std;
main ( )
{
int i;
i = 8;
i = i + 1;
cout << "This is a C++ program. " << i << "\n";
}
To compile and link using GNU's C++ compiler, type:
hostname{~}% g++ mine.cc -o mine
To run:
hostname{~}% mine