Skeleton Program

A basic C++ program that does absolutely nothing looks like this :

// file : skel.C
main()
{
}

Suppose we typed this in using a text editor and saved it as ``skel.C'' (remember, our C++ files must end with ``.C''). We could compile it by typing something like this :

g++ -o skel skel.C

This tells the ``g++'' compiler to compile the C++ source code in the file called ``skel.C'' and turn it into executable code. The executable code will be stored in a file called ``skel''. Note that ``skel'' is the file immediately following the ``-o'' option. Then, we could type :

skel
and our program would run. But since our program is designed to do nothing, this would be silly. But, that's how you compile something. In general, when people use a compiler, they name the executable the same name as the source code without the ``.C''.

Take note of the main(). This is the start of the main function. When your program starts executing, it goes to the first line of the main() function and starts executing your program sequentially, line by line from the beginning of main (the beginning of main() is donated by the ''{'' that immediately follows) to the end of main() (the end of main() is denoted by the ''}'' that ''matches'' the beginning of main()).