hello if anyone help me pls do iam currently working on a for loop that shows your name score average and grade but i cant seem to make the grade appear if anyone know how pls do here is my code here should be the output Enter Your Name: Quiz 1 Quiz 2 Quiz 3 Average Grade <- this one dont appear its on the if statement in my code
using namespace std;
int main(){
int nos[5][3]; //multi-dimention
int r, c;
char name[20];
int x[3];
int av=0;
char l;
do{
system("cls");
for(r=0; r<5; r++){ //Row
cout<<"Enter Your Name : ";
cin>>name;
for(c=0; c<3; c++){ //Column
cout<<"Enter Quiz "<<"["<<r<<"]"<<"["<<c<<"] : ";
cin>>nos[r][c];
}
cout<<"Average : "<<(float)(nos[r][0]+nos[r][1]+nos[r][2])/3<<endl;
av = ((float)nos[r][0]+nos[r][1]+nos[r][2])/3;
if(av==0 && av<=74.99){
cout<<"grade = 5.0"<<endl; }
if(av ==75 && av<=76.99){
cout<<"grade = 3.0"<<endl; }
if(av ==77 && av<=79.99){
cout<<"grade = 2.75"<<endl; }
if(av ==80 && av<=82.99){
cout<<"grade = 2.50"<<endl; }
if(av ==83 && av<=84.99){
cout<<"grade = 2.25"<<endl; }
if(av ==85 && av<=87.99){
cout<<"grade = 2.0"<<endl; }
if(av ==88 && av<=90.99){
cout<<"grade = 1.75"<<endl; }
if(av ==91 && av<=93.99){
cout<<"grade = 1.50"<<endl;}
if(av ==94 && av<=96.99){
cout<<"grade = 1.25"<<endl; }
if(av ==97 && av<=100){
cout<<"grade = 1.0"<<endl;}
}
cout<<"\nTry Another [Y/N] : ";
cin>>l;
}while(l!='N' && l!='n');
getch();
}
Aucun commentaire:
Enregistrer un commentaire