PROGRAMMING POINTERS, LESSON 1
1-1 Any program which uses the stream object or cout must have the following include statement:
1-2 Most statements in C++ end with a semicolon (;). Beginning programmers will often omit semicolons as they enter their source code. If the compiler issues the error message "missing semicolon" for a given line, look at the end of the previous line for the probable location of the missing semicolon.
1-3 The last line in function main should be: return 0;
This will avoid a warning message when compiling your program.
1-4 There exists a clrscr() command which will clear the output screen in Turbo C++ 3.0. To use this command, add the following code:
This command is not necessary in Metrowerks as the IDE (Integrated Development Editor) begins each program execution with a new output window. Turbo C++ 4.5 also uses an output window.
1-5 The code inside of function main should be indented, for readers of your source code to easily see that the statements inside of function main belong to function main. I suggest three (3) spaces per indent.
1-6 Put blank spaces on either side of the output operator (<<). This makes the statement easier to read.
cout << "This is easier to read" << endl;
cout<<"This is harder to read"<<endl;
The lack of spaces makes it harder to distinguish the section of code.
1-7 To freeze the output screen in the DOS/Turbo C++ 3.0 environment, add this statement at the end of your source code:
This function call will wait for you to hit the return key.
1-8 Each program should include your name and a brief description of the program as documentation statements.
1-9 Save your source codes with a file name that describes the program. For example, the lab in Lesson 1 could be called schedule.cpp.