Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Guidelines for C programs
1. Guidelines for C programs
The following guidelines apply to all C programs for this course.
A program should do what is requested, no more and no less. Do not add additional features. Do not omit requested features. Do not use language features not yet covered in class.
For input, provide an appropriate prompt and echo. Separate declarations, input, processing, and output. The output should be preceded by a blank line. If any requirement appears to conflict with the example input and output, go with the example input and output.
2. General requirements
The following are general requirements for all programs.
All input should have a prompt and an echo.
Variable declarations should not assign an initial value unless needed at that point.
Wherever possible, declarations, input, processing and output should be separated. This means only variables (and constants) and literals in output statements.
The prompt and echo for input is part of input, not output.
When easily done, variables should only be assigned a value once.
3. Specific requirements
The following are specific notes on the use of the C programming language.
Unless you are told to do so or are an expert and know what you are doing, always use double and never use float for floating point approximations. The printf and scanf specifiers should then always be lf (for long float) and not f (for float).
4. End of page