|
Mel Corley's Home | home
|
|
|
|
C++ Coding Standards
Documentation Guidelines:
1 2 3 4 5 6 7
123456789012345678901234567890123456789012345678901234567890123456789012345
///////////////////////////////////////////////////////////////////////////
// //
// Your Name userID //
// Program X Due HH:MM:SS a.m. MM/DD/YYYY //
// Give a complete description of the problem to be solved. //
// // ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// //
// functionName //
// //
// Give a complete description of the function //
// //
// Inputs: nameOfFirstParam : first parameter's description //
// nameOfSecondParam : second parameter's description //
// (repeat until you have described all parameters) //
// //
// Returns: returnVal : description of what is returned to caller //
// //
// Calls: list of functions called by this function, if any //
// //
///////////////////////////////////////////////////////////////////////////
Variable declarations:
int i, j, k; // used for looping
int ssn, hoursWorked;
float payRate, salary, stateTax, fedTax;
char groupId;
Executable code section:
if (a > b)
c = a;
if (a > b)
c = a;
else
c = b;
if (a > b)
{
c = a;
d = b;
} // then
else
{
c = b;
d = a;
} // else
while (a > b)
{
sum += a;
a--;
} // while
for (i = 1; i < 10; i++)
{
cout << "i = " << i << endl;
j *= i;
} // for
if (grade == 'A')
acount++;
else if (grade == 'B')
bcount++;
else if (grade == 'C')
ccount++;
else if (grade == 'D')
dcount++;
else if (grade == 'F')
fcount++;
else cout << "Invalid grade\n";
for (i = 1; i < 10; i++)
for (j = 1; j < 5; j++)
total += i * j;
// Read in and sum the grades.
while (....) ...
// Calculate the amortized interest rate.
...
// Check for possible divide-by-zero error.
...
} // functionName
|