CIS 150 C++ Programming Project: Input, output, calculations
Objectives
- Declare and use variables
- Perform calculations
- Display a variable
Program requirements
- Include documentation comments at the start of the file.
- Follow the course style guidelines including indentation, naming conventions, spaces instead of tabs, etc.
- Declare five floating point variables for five scores that will be entered. Initialize them all to 0.0.
- Declare a string variable to hold a name that will be entered. Initialize it to a zero length string.
- Declare a floating point variable that will hold the average score. Initialize it to 0.0.
- Prompt the user for five scores, get them and store them for later. They should be floating point values.
- Prompt the user for their name and store it for later. Names including spaces must be accepted properly.
Check the getline function for details on getting complete names and using cin.ignore() to eliminate extra
newlines cin leaves behind in the input buffer.
- Calculate the average score and display it in a personalized message to the user which includes
their name (see the example runs for details).
Points
- 3 points: Proper documentation comments
- 5 points: Follows style guidelines used in class (proper indentation, no tabs, variable names start with lowercase letter, etc.)
- 3 points: Variables properly declared and initialized
- 4 points: Five scores properly prompted for and gotten from the user
- 2 points: User input is done on the same line as the prompts
- 2 points: Newline at end of last score entered properly dealt with before full name entered
- 3 points: Full name properly prompted for and gotten from the user
- 4 points: Average calculated properly
- 4 points: Output message displays name and average (with any needed digits after the decimal point) correctly
Example run
Enter score #1: 65
Enter score #2: 72
Enter score #3: 87.5
Enter score #4: 91.3
Enter score #5: 69
Enter name: Chauncey Gardener
The average score for Chauncy Gardener is 76.96