Answer to Question #13977 in C++ for mac eleazar

Question #13977
write a C++ program that would input 10 grades and output the total passed and total failed.
1
Expert's answer
2012-08-31T08:18:23-0400
#include <iostream>




using namespace std;




void main(){

int passed=0, failed=0, grade;

for(int i=1; i<11; i++){

cout << "Grade #" << i << ": ";

cin >> grade;

if(grade < 3)

failed++;

else

passed++;

}

cout << endl << "Total passed: " << passed;

cout << endl << "Total failed: " << failed;

cout << endl;

}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS