Modified: Xiannong Meng for CS2330

1. Every program must have a **header** as follows:

// Name: Sally Brown // Course: CS2330 // Date: August 30, 1996 // Last Update: January 8, 1997 // Problem statement: This C++ program computes the volume // of Snoopy's house.2. Use

3. Use **spaces** __around__ '=' and and around operators and __after__
commas and semicolons. For example:

int weight, height; weight = 3.0 + height * 2.7;4. Use

5. For names of **objects** (variables) you will use lower case letters and
capitalize the first letter of the second and succeeding words (called
` camelBack` style, see Mercer page 30). The names of

const float PI = 3.14159; float letterGrade; class Fun { // stuff to define class };6. Use descriptive

7. Indent ` if`,

if( weight > 200) { cout << "Too Big!\n"; } else { cout << "Ok.\n"; } for(i = 1; i <= n; i ++) { s = s + i; cout << " Don't Panic!\n"; } do { i = i - 1; } while (i > 0);

// Intent: To sum the positive integers from 1 to n. // Pre: The variable n must have a value and n > 0. // Post: The function returns the sum from 1 to n. int Sum(int n) { // code for Sum }