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?
1
Expert's answer
2014-03-03T12:08:47-0500
#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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS