Question #37206

write a program to input details of five students name,rollnumber,marks of three subjects print the details of students who got more than 75 mark
1

Expert's answer

2013-11-22T09:29:51-0500
#include<iostream>
#include<string>
using namespace std;
struct student
{
    string name;
    int rollnumber;
    int sub[3];
};
int main()
{
    student st[5];
    for (int i = 0; i < 5; i++)
    {
        system("cls");
        cout<<"Enter name and roll number for student "<<i+1<<" : ";
        cin>>st[i].name>>st[i].rollnumber;
        for(int j = 0; j < 3; j++)
        {
            cout<<"Enter marks of student "<<i+1<<" for subject "<<j+1<<" : ";
            cin>>st[i].sub[j];
        }
    }
    system("cls");
    cout<<"Details of students who got more than 75 mark \n\n";
    for (int i = 0; i < 5; i++)
    {
        if ((st[i].sub[0] > 75) || (st[i].sub[1] > 75) || (st[i].sub[2] > 75))
        {
            cout<<"Student "<<i+1<<endl;
            cout<<"Name : "<<st[i].name<<endl;
            cout<<"Roll number : "<<st[i].rollnumber<<endl;
            for (int j = 0; j < 3; j++)
                cout<<"Mark of "<<j+1<<" subject : "<<st[i].sub[j]<<endl;
            cout<<"\n\n";
        }
    }
    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!
LATEST TUTORIALS
APPROVED BY CLIENTS