numStudents // good num_students // also fine lastName // good GPA // good, since its a pretty standard abbreviation ns // not so good the_number_of_students_in_the_class_im_taking // god help us...
for (int i = 0; i < 10; i++)
CalculateGrade PrintReport Maximum Factorial
x = temp; // set x to temp <---- well, DUH!
int test1, test2, final; // for user entry of test scores double average; // for storing the calculated test average int i; // loop counter
Good:
int num1, num2, num3; // user entered numbers double average; // calculated average of the numbers int score1, // score on exam 1 score2; // score on exam 2Bad:
int num1, num2, num3; // user entered numbers double average; // calculated average of the numbers int score1, // score on exam 1 score2; // score on exam 2Note that this second one looks junky and cluttered. Harder to read.
/* This function takes in a fahrenheit temperature (fahr) * and returns the equivalent temperature converted * to the celsius scale */ double ConvertToCelsius(double fahr) { ... }
{ int length, width; int area; // now another block, just for fun { cout << "Woo hoo!"; area = length * width; } cout << "Area = " << area; }