All the assignment code that you submit for this course is expected to follow these rules:
Put the following at the top of each .cpp file:
/* <filename>.cpp
CMPT 125 Summer 2012
Assignment <num>
Name: <your name as it appears on your SFU id card>
ST#: <your complete SFU id number>
*/
Replace everything in angle-brackets with the appropriate information.
Use consistent indentation to mark blocks code.
Use self-descriptive identifier names whenever it makes the code clearer. This is especially important for functions and classes. Short names are okay if the context makes it completely clear what the name is about. When in doubt, use a descriptive name.
Do not use C functions such as printf, scanf, malloc, free, etc. Instead, use cout, cin, new/new[] and delete/delete[]. This is a C++ course, not a C course, and so we want you to use C++ features.
Use C++ string objects instead of C-strings (which are just null-terminated arrays of characters) whenever possible. Sometimes C-strings are unavoidable in C++ (e.g. string literals are C-strings, and objects like ifstream don’t work with string).
Do not use the do/while loop. It is occasionally useful, but not as often as you might think. Instead, use for-loops or regular while-loops (or recursion if it makes sense!).
Do not use the switch statement. It doesn’t follow the same rules as other C++ constructs, and so tends to be error-prone. Instead, use if-statements.
Do not use break or continue. Instead, re-structure your code to use if-statements, loops, and functions.
The only permitted uses of macros are:
Do not use macros for anything else, such as defining constants or functions. Macros don’t follow the same rules as the rest of C++, and so tend to be error-prone.