2011-01-14T02:29:10-05:00
Write a c++ program that reads 5 student names and grades then prints the number of pass and fail students . Remarks : Passing grade is 60?
1
2011-01-17T05:26:25-0500
#include <iostream> #include <string> using namespace std; int main(int argc, char** argv) { & string* names = new string[5]; & int* grades = new int[5]; & int passed = 0; // number of pass students & cout << "Please input names of 5 students(Ex: Name Grade):" << endl; & for(int i = 0; i < 5; i++) & { cin >> *(names + i); cin >> *(grades + i); & } & for(int i = 0; i < 5; i++) & { if(*(grades + i) >= 60) { passed++; } & } & cout << "Number of pass students: " << passed << endl; & cout << "Fail: " << 5 - passed << endl; & delete[] names; & delete[] grades; & 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 !
Learn more about our help with Assignments:
C++
Comments