Answer to Question #173243 in C++ for Sivasurya G

Question #173243

The Admission to a professional course is done using the following conditions.


a) Marks in Maths> =60


b) Marks in Physics >=50


c) Marks in chemistry >=40


d) Total in all the three subjects >=200 (or) Total in Maths and Physics >=150


Given the marks of three subjects, write a C++ program to process the applications to list the eligible candidates.


1
Expert's answer
2021-03-19T15:34:27-0400


#include <iostream>
#include <list>
#include <string>
using std::cout;
using std::cin;
using std::list;
using std::string;

bool  getstatus(int arg[])
{
    if (arg[0] <60 || arg[1] < 50 || arg[2] < 40  )
        return false;
    else if ((arg[0]+arg[1]+arg[2])>=200 or (arg[0] + arg[1])>=150)
        return true;
    return false;
}

int main()
{
    string run ;
    int marks[3];
    string name;
    list <string > names;
    while (true)
    {
        cout<< "Enter name respondent ";
        cin >>name;
        cout << "Enter Marks in Maths ";
        cin >> marks[0];
        cout << "Enter Marks in Physics ";
        cin >> marks[1];
        cout << "Enter Marks in Chemistry ";
        cin >> marks[2];
        if (getstatus(marks) )
        {
            names.push_back(name);
            cout << name << " passed the tests successfully and added the list" << std::endl;
        }
        cout << "Continue data entry Yes(No)" ;
        cin >> run;
        if (run=="No"||run=="no")
            break;
      }
    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