Hey Guys, I'm Having trouble with this program..
Assignment: ask how many students test scores user wants to input. Using loop structure, enter the test scores(must be at least 6). Program should count and print number of A's, B's, C's, D's, and F's. It should Average and find the largest of all scores.
MY PROBLEM: finding the largest of all scores...here is my code.
#include <iostream.h>
#include <stdlib.h>
main()
{int Num, C, Sum=0, Tot1=0, Tot2=0, Tot3=0, Tot4=0, Tot5=0, Tot6=0, Grade=0; float Avg;
cout<<"\nHow Many Test Scores do you want to enter?- You Must enter at least 6: ";cin>>Num;
if(Num<6)
{cout<<"\nSorry, You Must enter at least 6 Test Scores: ";}
else{
int Test[Num-1];
for(C=0;C<Num;C++)
{cout<<"\n Enter Score "<<C+1<<": "; cin>>Test[C];
if(Test[C]<=100 && Test[C]>=90)
{Grade=1;
Tot1=Tot1+Grade;}
else if(Test[C]<90 && Test[C]>=80)
{Grade=1;
Tot2=Tot2+Grade;}
else if(Test[C]<80 && Test[C]>=70)
{Grade=1;
Tot3=Tot3+Grade;}
else if(Test[C]<70 && Test[C]>=60)
{Grade=1;
Tot4=Tot4+Grade;}
else if(Test[C]<60 && Test[C]>=0)
{Grade=1;
Tot5=Tot5+Grade;}
else
{Grade=1;
Tot6=Tot6+Grade;}
Sum=Sum + Test[C];
}
Avg=Sum/Num;
cout<<"\n The Average is "<<Avg;
cout<<"\n There are "<<Tot1<<" A's ";
cout<<"\n There are "<<Tot2<<" B's ";
cout<<"\n There are "<<Tot3<<" C's ";
cout<<"\n There are "<<Tot4<<" D's ";
cout<<"\n There are "<<Tot5<<" F's ";
cout<<"\n There are "<<Tot6<<" Invalid Grades ";
}
system("PAUSE");
return 0;
}