Coding Style
For your sanity (and ours), here are a set of suggested style guidelines.
Note that these are suggestions only; we don’t require a specific style. However, we may ask you to reformat your code before assisting you in Office Hours.
Comments
You should comment every function. Comments should explain the purpose of the function in at least one complete sentence:
/**
* This function sets the radius of the current Sphere object
* to be equal to the value specified in the parameter.
**/
void Sphere::setRadius(double newRadius)
{
...
}
Curly Braces
There are many opinions on where to put starting braces. Pick a style that works for you, and be consistent!
See here for some common brace styles.
Inclusion Guards
Header files must have include guards to prevent multiple inclusion. These should be in the format <FILENAME>_H
:
#ifndef STACK_H
#define STACK_H
...
#endif
Tabs
Again, there are many opinions on whether to use tabs or spaces; pick one and be consistent.