COSC 503: Software Design and Development I



(1) Every .cpp FILE must include a header comment with this format,
as the first information in the file:

/* AUTHOR: put your name here
TA: whoever is your TA - omit if there is no TA
COURSE: COSC 503, Software Design and Development I
SEMESTER: Fall 2008


ASSIGNMENT No.: X
PROJECT/ASSIGNMENT: Topic
DUE DATE: date specified
SUBMISSION DATE: when you handed it in
SUMMARY: tells what the code does

INPUT: Keyboard, file, none, ? What data types?

OUTPUT: What shows up on the screen, what is written to any files, etc.

ASSUMPTIONS
What do you expect the user to know, to do, to NOT do, etc.

*/

(2) All code, comments, and output should fit on the page;
i.e., they should not wrap around or be truncated.
Long statements that would run off the page should be split
in a logical manner and should be indented at least 3 spaces.

(3) Each statement begins on a new line.

(4) Identifiers must be meaningful - variable, constant, method, class names

(5) C++ is case sensitive.
Class names should start with a capital letter and use mixed case.
variable and method names should start with a lower case letter and use
mixed case.
CONSTANTS should be all capitals and use underscore to separate words.

(6) Comment all variables, constants, methods, classes, lines of code, etc.
whose meaning would not be obvious to a beginning programmer.
Names like temp and button3 are not meaningful. (Often, a better name
for a variable can be found in the comment. Then you don't need
the comment any more!)

(7) Blank lines separate logical blocks of code.

(8) Comment logical blocks of code (like chapter titles in a book).

(9) Left braces { must appear on a new line right under the first character
of the previous line. Right braces } must line up with the corresponding left
brace and have a comment telling what is ending. For example:

#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!\n";
return 0;
}//main

(10) Indent 3 spaces inside each pair of {} or each control statement.
(Use a fixed width font (Monaco, Courier, etc.) so the spaces show up.)

while (x < 5)
x += 5;

while (y > 7)
{
x++;
y += x + z;
z = y + x;
} // while

(11) Put a space before and after all binary operators.