Answer to Question #10247 in C++ for Suzy

Question #10247
Create a program that will ask for a series of marks out of 55 and calculate the number of fails, passes, credit and distinctions and output to the screen
-fails<50%
-Pass>=75% and <75%
credit >=75% and <85%
distinction>=85%
1
Expert's answer
2012-11-12T07:35:48-0500
#include <iostream>
using namespace std;
int main ()
{
int mark;
int fails = 0, pass = 0, credit = 0, distinction = 0;
for (int i = 0; i < 50; i++){
& cout << "Enter your mark: " << endl;
& cin >> mark;
& if (mark < 50) {
& fails++;
& }
& else if (mark > 50 && mark <= 75) {
& pass++;
& }
& else if (mark > 75 && mark < 85) {
& credit++;
& }
& else& if (mark > 85) {
& distinction++;
& }
}
cout << "Fails: " << fails << endl;
cout << "Pass: " << pass << endl;
cout << "Credit: " << credit << endl;
cout << "Distinction: " << distinction << endl;
system("pause");
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS