|
|
|
|
|
|
|
complicated C++ statement requires some explanation, the pseudocode statement should be written to the right of the C++ statement. For example: |
|
|
|
|
|
|
|
|
while (filel && file2) // While neither file is empty
{
.
.
. |
|
|
|
|
|
|
|
|
In addition to the four main types of comments that we have discussed, there are some miscellaneous comments that we should mention. (1) After the main function, we recommend using a row of asterisks (or dashes or equal signs or ) in a comment before and after each function to help it to stand out. For example: |
|
|
|
|
|
|
|
|
//******************************************************************
void PrintSecondHeading()
{
.
.
.
}
//****************************************************************** |
|
|
|
|
|
|
|
|
(2) In this text, we use C++'s alternative comment form |
|
|
|
|
|
|
|
|
to document the flow of information for each formal parameter of a function: |
|
|
|
|
|
|
|
|
void GetData( /* out */ int age, // Patient's age
/* out */ int weight ) // Patient's weight
{
.
.
.
}
void Print( /* in */ float val, // Value to be printed
/* inout */ int& count ) // Number of lines printed
// so far
{
.
.
.
} |
|
|
|
|
|