Answer to Question #13289 in C++ for mark
write a c++ program that would input 10 grades and output the total passed and total failed.
1
2012-08-17T10:30:56-0400
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main()
{
int grades[10];
int totalPassed=0;
int totalfailed=0;
for(int i=0;i<10;i++){
cout<<"Enter grade "<<(i+1)<<": 3";
cin>>grades[i];
}
for(int i=0;i<10;i++){
if(grades[i]>=60){
totalPassed++;
cout<<"Grade "<<(i+1)<<" is passed
";
}else{
cout<<"Grade "<<(i+1)<<" is
failed
";
totalfailed++;
}
}
cout<<"Total passed are: "<<totalPassed<<"
";
cout<<"Total failed are: "<<totalfailed<<"
";
getch();
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment