Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that will input letter grades (A,B,C,D,F), the number of which i

ID: 3628331 • Letter: W

Question

write a 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 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.

So my output would look like this as follow down below :

Please input the number of grades to be read in (1-50)
6
Input a grade
A
Input a grade
C
Input a grade
A
Input a grade
B
Input a grade
B
Input a grade
D


Number of A =2
Number of B =2
Number of C =1
Number of D=1
Number of F =0

Explanation / Answer

#include<iostream>

using namespace std;

int main()

{

char a[50];

int A=0,B=0,C=0,D=0,E=0,F=0;

int n;

cout<<"enter no of grades";

cin >>n;

for(int i=0; i<n; i++)

cin >> a[i];

for(inti=0; i<n; i++)

{

if(a[i]=='A') A++;

if(a[i]=='B') B++;

if(a[i]=='C') C++;

if(a[i]=='D') D++;

if(a[i]=='E') E++;

if(a[i]=='F') F++;

}

cout << "no of A's " << A <<endl;

cout << "no of B's " << B <<endl;

cout << "no of C's " << C <<endl;

cout << "no of D's " << D <<endl;

cout << "no of E's " << E <<endl;

cout << "no of F's " << F <<endl;

return 0;

}