A Simple C++ Program Illustrating Documentation StyleProgramming/Documentation Style Guidelines1. Choose meaningful/suggestive variable and function names.2. Indent lines properly as illustrated in the below example.3. A binary operator is preceded and followed by a space. 4. A left parenthesis is followed by a space and a right parenthesis is preceded by a space.5. Use comment statements judiciously: do not under or over comment the program.6. Every function prototype must be followed by comments, which clearly specify the pre- andpost-conditions of the function.7. On top of the main function, you must use comment statements to specify the course number andtitle, programmer's name, assignment (Ex #, Prob #) date assigned, date submitted, and remark (aconcise description of the program).8. Separate different groups (e.g., functions and functions prototypes) with a blank line.9. You must hand in the sources code and the output on separate pages. Remember that you cannotearn more than 50% of the credits without handing in the correct output! Do not use a wordprocessor to fake an output, which will results in "negative" points.A Simple C++ Program Illustrating Documentation Style// Course: CS230-01 Computer Science I, Summer I, 2001// Name: Doe, John// Assignment: Exercise 1.3 Problem 2// Date assigned: May 21, 2001// Date submitted: May 24, 2001// Remark: This program computes the sum of two integers entered by the user and // prints out the result.int sum ( int, int );// Pre-condition: the function accepts two integers through call-by-value mechanism// Post-condition: the function computes and returns the sum of two integer valuesint main ( ){int num1, num2, total;cout << "Please enter two integer values separated by a space then press enter key: ";cin >> num1 >> num2;total = sum ( n1, n2);cout << "\nThe sum of " << num1 << " and " << num2 << " is " << total << endl;return 0;}int sum ( int m, int n){ return ( m + n );}How to indent a selection structure: the if-else statement. . . . . .if ( condition ) { if ( condition )true task; or {} else { true task;false task; }} else{. . . false task;}. . .How to indent a repetition/loop structure: the if-else statement. . . . . .while ( condition ) { while ( condition )loop task; or {} loop task;}. . . . .
View Full Document