// 10.5.cpp : This file contains the 'main' function. Program execution begins and ends there. // Written by Jacob Knox // #include using namespace std; const int NUM_SCORES = 10; const int NUM_GRADES = 5; int main() { float scores[NUM_SCORES] = {}; char grades[NUM_SCORES] = {}; int counts[NUM_GRADES] = {0, 0, 0, 0, 0}; float score = 0, tot = 0, avg = 0; for (int i = 0; i < NUM_SCORES; i++) { cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": "; cin >> score; scores[i] = score; tot += score; if (score >= 90) { grades[i] = 'A'; counts[0]++; } else if (score >= 80) { grades[i] = 'B'; counts[1]++; } else if (score >= 70) { grades[i] = 'C'; counts[2]++; } else if (score >= 60) { grades[i] = 'D'; counts[3]++; } else { grades[i] = 'F'; counts[4]++; } } avg = tot / (float)NUM_SCORES; for (int i = 0; i < NUM_SCORES; i++) { cout << "The " << i + 1 << " student recived a " << scores[i] << "% and got a(n) " << grades[i] << ".\n"; } cout << "The average score is: " << avg << "%.\n"; char letter; for (int i = 0; i < NUM_GRADES; i++) { if (i != 4) { letter = 65 + i; } else { letter = 70; } cout << "There were " << counts[i] << letter << "'s.\n"; } }