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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CODE FOR PROBLEM #1 (LEARN BY DOING) ON PAGE 247 IS BELOW
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#include <iostream>
//#include <iomanip>
//
//using namespace std;
//
//const int NUM_SCORES = 10;
//
//int main()
//{
// float currStudent[NUM_SCORES]{ 0.0 };
// char currStudGradeLTR[NUM_SCORES]{};
//
// float scoreSum = 0.0;
// float scoreAvg = 0.0;
//
// int freqA = 0;
// int freqB = 0;
// int freqC = 0;
// int freqD = 0;
// int freqF = 0;
//
// cout << "\n\tSTUDENT SCORE GRADER AND SIMPLE CLASS ANALYSIS PROGRAM\n\n";
//
// for (int i = 0; i < NUM_SCORES; i++) //puts scores into array
// {
// cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": ";
// cin >> currStudent[i];
// }
//
// for (int i = 0; i < NUM_SCORES; i++) //translates scores to grades and puts into another array
// {
// if (currStudent[i] < 65.0)
// {
// currStudGradeLTR[i] = 'F';
// }
// else if (currStudent[i] >= 65.0 && currStudent[i] < 75.0)
// {
// currStudGradeLTR[i] = 'D';
// }
// else if (currStudent[i] >= 75.0 && currStudent[i] < 84.0)
// {
// currStudGradeLTR[i] = 'C';
// }
// else if (currStudent[i] >= 84.0 && currStudent[i] < 92.0)
// {
// currStudGradeLTR[i] = 'B';
// }
// else if (currStudent[i] >= 92.0)
// {
// currStudGradeLTR[i] = 'A';
// }
// }
//
// for (int i = 0; i < NUM_SCORES; i++) //finds sum of scores
// {
// scoreSum += currStudent[i];
// }
//
// scoreAvg = scoreSum / NUM_SCORES; //finds class score average
//
// for (int i = 0; i < NUM_SCORES; i++) //counts frequency of different letter grades
// {
// if (currStudGradeLTR[i] == 'A')
// {
// freqA++;
// }
// if (currStudGradeLTR[i] == 'B')
// {
// freqB++;
// }
// if (currStudGradeLTR[i] == 'C')
// {
// freqC++;
// }
// if (currStudGradeLTR[i] == 'D')
// {
// freqD++;
// }
// if (currStudGradeLTR[i] == 'F')
// {
// freqF++;
// }
// }
//
// cout << "\n\n\t\t Score Grade";
//
// for (int i = 0; i < NUM_SCORES; i++) //displays list of scores with letter grades
// {
// cout << right << "\n\tScore #" << setw(2) << setfill(char(32)) << i + 1 << ": "
// << setw(7) << setfill(char(32)) << left << currStudent[i] << " " << currStudGradeLTR[i];
// }
//
// cout << "\n========================================================"; //displays class analysis (average and frequency of letter grades)
// cout << "\n\n\tClass score average: " << scoreAvg;
// cout << "\n\n\n\tFrequency of letter grades:";
// cout << "\n\n\t\tA: " << freqA;
// cout << "\n\t\tB: " << freqB;
// cout << "\n\t\tC: " << freqC;
// cout << "\n\t\tD: " << freqD;
// cout << "\n\t\tF: " << freqF << "\n\n" << endl;
//
// return 0;
//}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CODE FOR PROBLEM #1 (LEARN BY DOING) ON PAGE 253 IS BELOW
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#include "Header.h"
//
//int main()
//{
// const int NUM_SCORES = 10;
//
// float currStudent[NUM_SCORES]{ 0.0 };
// char currStudGradeLTR[NUM_SCORES]{};
//
// float scoreSum = 0.0;
// float scoreAvg = 0.0;
//
// int freqA = 0;
// int freqB = 0;
// int freqC = 0;
// int freqD = 0;
// int freqF = 0;
//
// cout << "\n\tSTUDENT SCORE GRADER AND SIMPLE CLASS ANALYSIS PROGRAM\n\n";
//
// //puts scores into array
// GetInput(currStudent, NUM_SCORES);
//
// //translates scores to grades and puts into another array
// ScoreToGrade(currStudent, currStudGradeLTR, NUM_SCORES);
//
// //finds sum and average of scores
// ScoreAvg(currStudent, NUM_SCORES, scoreSum, scoreAvg);
//
// //counts frequency of different letter grades
// Frequency(currStudGradeLTR, NUM_SCORES, freqA, freqB, freqC, freqD, freqF);
//
//
// cout << "\n\n\t\t Score Grade";
//
//
// //displays list of scores with letter grades and class analysis
// Display(currStudent, currStudGradeLTR, scoreSum, scoreAvg, freqA, freqB, freqC, freqD, freqF, NUM_SCORES);
//
// return 0;
//}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CODE FOR PROBLEM #2 (LEARN BY DOING) ON PAGE 260 IS BELOW
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#include "Header.h"
//
//int main()
//{
// char firstName[61]{};
// char lastName[61]{};
// char fullName[121]{};
//
// //fullName[0]{ '\32' };
//
// cout << "\n\t\t=========================================";
// cout << "\n\t\t First/last name combiner using arrays";
// cout << "\n\t\t=========================================";
//
// //prompts for first and last name and puts them into arrays
// getInput(firstName, lastName);
//
// //combines first and last names into another array
// nameCombine(firstName, lastName, fullName);
//
// //displays full name from array
// display(fullName);
//
// return 0;
//}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CODE FOR PROBLEM #7 (EXERCISES) ON PAGE 273 IS BELOW
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//#include "Header.h"
//
//int main()
//{
// char string_1[] = "Frank";
// char string_2[] = "Franklyn";
//
// int flag = 0;
//
// compareStrings(string_1, string_2, flag);
//
// if (flag != 0)
// {
// cout << "\n\tDifferent" << endl;
// }
//
// else
// {
// cout << "\n\tSame" << endl;
// }
//}
|