STYLE GUIDELINES
CS3358 Spring 2015
Jill Seaman

Header comments (file documentation block) should be at the top of each file and should contain:
File Name, Author, Date, Assignment Number, Course number and section, Instructor, and a brief description of the purpose of the code in the file.

// File Name: card.cpp
// 
// Author: Your Name Here
// Date: 05/18/2012
// Assignment Number: 1
// CS 3358 Spring 2015
// Instructor: Jill Seaman 
// 
// A representation of a playing card

#include directives must follow header comments, before the rest of the program.

Comments for variables and functions:
All variable definitions should be commented as follows:

int  rank;    // numeric value for the card, A=1, J=11, Q=12, K=13

Function definitions should be commented to describe what it does, what the parameters are, and what the function returns (when appropriate).  See the template and the example below.  If the function body contains more than about five statements, there should be comments to describe the various sections of code in the function body.

Template:
//***********************************************************
// function name: short description of what the function does.
//
// param-1 description of first parameter (if any)
// param-2 description of second parameter (if any)
// (remaining params, if any)
// returns: description of what function returns (if not void)
//***********************************************************

Example:
//***********************************************************
// rankString:  returns a card rank as "A", "2", ..."J", "Q", "K"
// r: a rank (1-13)
// returns the rank of the parameter as a string.
//***********************************************************

string rankString(int r)  {
   // function body goes here
}

DO NOT comment evey line of code!  If you have commented the variable definitions and the function definitions, you should need only one comment per "section" of code.

Variable names:
--must be meaningful
--loop index names can be simple (i, j, k, etc)
--The initial letter should be lowercase, following words should be capitalized, no other caps or punctuation (ie: weightInPounds)

Named constants:
--use for most numeric literals, including array sizes
--all capitals with underscores (ie: TX_STATE_SALES_TAX)
--should occur at top of function, or global (only if necessary)

Line length of source code should be no longer than 80 characters (no wrapping of lines).

Indentention:
--Use 2-4 spaces (but be consistent throughout your program).
--Indent blocks, within blocks, etc.
--Use blank lines to separate sections.