1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
Sample Output
Frame Score Game
1 20 20
2 17 37
3 9 46
4 29 75
5 19 94
6 9 103
7 19 122
8 20 142
9 20 162
10 19 181
Input:
No data comes from the keyboard; all data, including the data
for the array, are contained within the program.
TODO #1: in the main() function,
complete declaration of integer array of ten bowling scores.
Compile-time array with initialization list of scores.
Processing and Output:
TODO #2: in the main() function,
complete the call to display() function
-see prototype for parameter specifics
TODO #3: code the complete display() function
-see directions in function comments
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main(void)
{
/* declarations ------------------------------------------------*/
// constants
const int SIZE = 10;
// function prototype(s)
void displayScores(const int scores[], const int SIZE);
// TODO #1: declare & initialize score array with scores above
// array data: use data from Score column of sample output
// STUDENT CODE BEGINS
const int scores [9] = {20, 17, 9, 29, 19, 9, 19, 20, 20, 19};
int scores;
// STUDENT CODE ENDS
/* statements ------------------------------------------------*/
// start the program
// TODO #2: call display function, passing the array contents and size
// replace the two underlines with the correct parameters
// STUDENT CODE BEGINS
// STUDENT CODE ENDS
// terminate the program
cout << endl;
cout << "*** end of 276Arrays_01.cpp program ***" << endl << endl;
cin.get();
return 0;
} // end main()
/*--------------------------------------------------------------------//
// Function Name: displayScores()
// Parameters: score : const int[]
// SIZE : const int
// Return: void
//
// Purpose: to display bowling scores and total by frame
//
// Notes:
// use a 'for' loop
// format (setw, left, right, etc) & display headings
// format (setw, left, right, etc) & display frame details
//--------------------------------------------------------------------//
// TODO #3: code the display function
// Suggested Algorithm
declare local variables (if needed)
format & print column headings
display detail lines
for each bowling frame (use a 'for' loop)
format & print frame number
format & print frame score
format & print game score
end for loop
*/
// STUDENT CODE BEGINS
// STUDENT CODE ENDS
|