Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Programming Standards
This document lists the programming standards that you must follow for the
programming questions of your assignments and exams.
Failure to follow these standards will result in the loss of marks.
1. Each of your program files must begin with a comment block like the
following:
2. If the purpose of a routine is not self-explanatory, write a prologue comment
at the beginning, similar to the following:
//-----------------------------------------
// NAME: your name
// STUDENT NUMBER: your student number
// COURSE: COMP 3430, SECTION: Axx
// INSTRUCTOR: name of your instructor
// ASSIGNMENT: assignment #, QUESTION: question #
//
// REMARKS: What is the purpose of this program?
//
//-----------------------------------------
//------------------------------------------------------
// myRoutine
//
// PURPOSE: tell me what it does!
// INPUT PARAMETERS:
// Describe those parameters which accept data values.
// OUTPUT PARAMETERS:
// Describe those parameters which return values.
// Include the value returned by the routine if not void.
// Some of these may be the same as the input
Parts of the prologue may be omitted if appropriate, e.g., if the
routine
has no parameters.
3. Use blank lines to separate blocks of code and declarations to improve
readability. In particular, use blank lines between declarations and other
code, and between routines.
4. Comment blocks of code. Describe why you wrote the code this way, not what
each line does. For example:
5. Use meaningful but reasonable variable names.
a – Very bad. too short, not meaningful.
averageMark – Good
average_of_all_the_marks_in_the_list – Bad. Too long and wordy.
If a concise variable name does not completely describe the data it stores, add
a comment to the declaration with additional information.
6. Use indentation properly, and align else with the corresponding if for
readability. Any readable and consistent style is acceptable.