diff options
Diffstat (limited to 'CST116F2021-Lab5/CST116F2021-Lab5.cpp')
| -rw-r--r-- | CST116F2021-Lab5/CST116F2021-Lab5.cpp | 161 |
1 files changed, 81 insertions, 80 deletions
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.cpp b/CST116F2021-Lab5/CST116F2021-Lab5.cpp index 2b9258b..d305c1e 100644 --- a/CST116F2021-Lab5/CST116F2021-Lab5.cpp +++ b/CST116F2021-Lab5/CST116F2021-Lab5.cpp @@ -1,19 +1,20 @@ // CST116F2021-Lab5.cpp : This file contains the 'main' function. Program execution begins and ends there. // -#include <iostream> -//#include "Header1.h" -using namespace std; - -void GetScores(float []); -void CheckGrade(float [], char []); -float calcAvg(float [], float avg); -void CountScores(char [], int []); - -const int NUM_SCORES = 10; -const int NUM_STUD = 5; -const int NUM_GRADE = 5; +#include "Header1.h" +//#include <iostream> +// +//using namespace std; +// +//void GetScores(float []); +//void CheckGrade(float [], char []); +//float calcAvg(float [], float avg); +//void CountScores(char [], int []); +// +//const int NUM_SCORES = 10; +//const int NUM_STUD = 5; +//const int NUM_GRADE = 5; int main() { @@ -31,74 +32,74 @@ int main() return 0; } -void GetScores(float score_input[]) -{ - //Loop for storing scores to array - for (int i = 0; i < NUM_SCORES; i++) - { - cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": "; - cin >> score_input[i]; - } -} - -void CheckGrade(float score_input[], char grade_output[]) -{ - //Loop for comparing scores to letter grade then storing to another array - for (int i = 0; i < NUM_SCORES; i++) - { - if (score_input[i] >= 92.0) - grade_output[i] = 'A'; - else if (score_input[i] >= 84.0) - grade_output[i] = 'B'; - else if (score_input[i] >= 75.0) - grade_output[i] = 'C'; - else if (score_input[i] >= 65.0) - grade_output[i] = 'D'; - else - grade_output[i] = 'F'; - - cout << "\nTest #" << i + 1 << " scored " << score_input[i] << " and received grade " << grade_output[i]; - } -} - -float calcAvg(float score_input[], float avg) -{ - //Calc class average - for (int i = 0; i < NUM_SCORES; i++) - { - avg += score_input[i]; - } - - avg /= NUM_SCORES; - - cout << "\n\nThe class average for " << NUM_SCORES << " scores is " << avg << endl; - - return avg; -} - -void CountScores(char grade_output[], int nGrade[]) -{ - //Loop for counting number of each letter grade - for (int i = 0; i < NUM_SCORES; i++) - { - if (grade_output[i] == 'A') - nGrade[0] += 1; - else if (grade_output[i] == 'B') - nGrade[1] += 1; - else if (grade_output[i] == 'C') - nGrade[2] += 1; - else if (grade_output[i] == 'D') - nGrade[3] += 1; - else - nGrade[4] += 1; - } - - cout << "\nThe number of Grade A tests is: " << nGrade[0]; - cout << "\nThe number of Grade B tests is: " << nGrade[1]; - cout << "\nThe number of Grade C tests is: " << nGrade[2]; - cout << "\nThe number of Grade D tests is: " << nGrade[3]; - cout << "\nThe number of Grade F tests is: " << nGrade[4]; -} +//void GetScores(float score_input[]) +//{ +// //Loop for storing scores to array +// for (int i = 0; i < NUM_SCORES; i++) +// { +// cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": "; +// cin >> score_input[i]; +// } +//} +// +//void CheckGrade(float score_input[], char grade_output[]) +//{ +// //Loop for comparing scores to letter grade then storing to another array +// for (int i = 0; i < NUM_SCORES; i++) +// { +// if (score_input[i] >= 92.0) +// grade_output[i] = 'A'; +// else if (score_input[i] >= 84.0) +// grade_output[i] = 'B'; +// else if (score_input[i] >= 75.0) +// grade_output[i] = 'C'; +// else if (score_input[i] >= 65.0) +// grade_output[i] = 'D'; +// else +// grade_output[i] = 'F'; +// +// cout << "\nTest #" << i + 1 << " scored " << score_input[i] << " and received grade " << grade_output[i]; +// } +//} +// +//float calcAvg(float score_input[], float avg) +//{ +// //Calc class average +// for (int i = 0; i < NUM_SCORES; i++) +// { +// avg += score_input[i]; +// } +// +// avg /= NUM_SCORES; +// +// cout << "\n\nThe class average for " << NUM_SCORES << " scores is " << avg << endl; +// +// return avg; +//} +// +//void CountScores(char grade_output[], int nGrade[]) +//{ +// //Loop for counting number of each letter grade +// for (int i = 0; i < NUM_SCORES; i++) +// { +// if (grade_output[i] == 'A') +// nGrade[0] += 1; +// else if (grade_output[i] == 'B') +// nGrade[1] += 1; +// else if (grade_output[i] == 'C') +// nGrade[2] += 1; +// else if (grade_output[i] == 'D') +// nGrade[3] += 1; +// else +// nGrade[4] += 1; +// } +// +// cout << "\nThe number of Grade A tests is: " << nGrade[0]; +// cout << "\nThe number of Grade B tests is: " << nGrade[1]; +// cout << "\nThe number of Grade C tests is: " << nGrade[2]; +// cout << "\nThe number of Grade D tests is: " << nGrade[3]; +// cout << "\nThe number of Grade F tests is: " << nGrade[4]; +//} //p.247 //const int NUM_SCORES = 10; |