////////////////////////////////////////////////////////////////////// // // hello.cpp // // Started by Jeff Ondich on 3/30/98 // Last modified 9/16/99 // // This is the traditional first program in most // programming languages. The order of business is to // get a program to give you output. // // 1. To "compile" this program (that is, to translate it from C++ // into a language the machine can understand and execute), type // // g++ -g -Wall -o hello hello.cpp // // This process will create a new file called "hello", which // is known as the "executable" version of the program (hello.cpp // is the "source code"). By typing "ls", you can see that // your account now has the file "hello" in it. // // 2. To run the executable program, type // // hello // // 3. What happens if you remove the "<< endl" and // recompile and rerun the program? // // 4. What happens if you remove the "#include " and // recompile the program? // // 5. You don't have to name the executable program the same // thing as the source code, though it is usually a good idea // to do so. Try recompiling like so: // // g++ -g -Wall -o muskox hello.cpp // // Do an "ls" to make sure the new executable is in your // account. // // 6. Type "ls -l". This gives you the long form of a listing // of your account. The fourth column in this listing gives you // the size, in bytes, of each file. How does the size of // the executable program compare with the size of the source // code? To save space in your account, you can remove // old executables using, for example, "rm hello". // ////////////////////////////////////////////////////////////////////// #include int main( void ) { cout << "Hello, world." << endl; return( 0 ); }