Write a C++ program that will input letter grades (A, B, C, D, F), the number of
ID: 3689579 • Letter: W
Question
Write a C++ program that will input letter grades (A, B, C, D, F), the number of which is input by the user (a maximum of 50 grades). The grades will be read into an array. A function will be called five times (once for each letter grade) and will return the total number of grades in that category. The input to the function will include the array, number of elements in the array and the letter category (A, B, C, D or F). The program will print the number of grades that are A, B, etc.
Explanation / Answer
#include using namespace std; double countGrade(char letterCategory, int size, char array); const int SIZE = 5; char letterCategory[SIZE] = {'A', 'B', 'C', 'D', 'F'}; char userLetters[50]; int main() { // Declare Variables int numberOfGrades = 0; int gradeNumbersA = 0; int gradeNumbersB = 0; int gradeNumbersC = 0; int gradeNumbersD = 0; int gradeNumbersF = 0; // Get the number of grades to be read cout > numberOfGrades; // Input Validation if(numberOfGrades < 1 || numberOfGrades > 50) { cout > numberOfGrades; } while(numberOfGrades < 1 || numberOfGrades > 50); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.