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

Answer to Question #1343 in C++ for samali20100

Question #1343
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?

Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions