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?
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"; } }
Comments
Leave a comment