This code:
if(mark>=90)
grade[0];
else if
Doesn't do anything - you access the grade character you want, but you don't do anything with it.
Before the
if
test, create a
char
variable called
currentGrade
and inside each
if
assign it to the grade you want:
if(mark>=90)
currentGrade = grade[0];
else if
You can then output the grade from
currentGrade
after all the tests are complete in your
cout
statement instead of
grade[x]
:
cout<<"student "<<students<<" mark is "<<mark<<" and grade is "<<currentGrade;
Give it a try and see what happens!