60 721
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #39349 in C++ for Josue Rafael Ganub

Question #39349
Write a c++ program that reads upto 50 student names,grades, and average then prints the number of pass and fail students . Remarks : Passing grade is 60?
Expert's answer
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;
//main function
int main(int argc, char *argv[])
{
string names[50];//variable array for names
int grades[50];//variable array for grades
double average[50];//variable array for average
for(int i=0;i<50;i++){
//promt user to enter name
cout<<"Enter name: ";
cin>>names[i];
//promt user to enter grade
cout<<"Enter grade: ";
cin>>grades[i];
//promt user to enter average
cout<<"Enter average: ";
cin>>average[i];
}
//show result
for(int i=0;i<50;i++){
if(grades[i]<60){
cout<<"Student "<<names[i]<<" failed\n";
}else{
cout<<"Student "<<names[i]<<" passed\n";
}
}

//delay
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions