Answer to Question #243213 in C++ for jersonjangerona

Question #243213

Name          Q1      Q2     Q3      Q4     Q5   

              Jean  

                  Mark

                  Von                  20

                  Ben

                  Jessie

                  Yno


1
Expert's answer
2021-09-27T15:46:21-0400
#include <iostream>


using namespace std;


int main()
{
    int marks[5];
    int n;
    cout<<"\nEnter the number of students:";
    cin>>n;
    string names[n];
    for (int i=0;i<n;i++){
        cout<<"\nEnter details for student "<<(i+1)<<": ";
        cout<<"\nEnter name: ";
        cin>>names[i];
        for(int j=0;j<5;j++){
            cout<<"\nEnter mark for subject "<<(j+1)<<": ";
            cin>>marks[i];
        }
    }
    cout<<"\nName\t\tQ1\t\tQ2\t\tQ3\t\tQ4\t\tQ5";
    for(int i=0;i<n;i++){
        cout<<"\n"<<names[i]<<"\t\t";
        for(int j=0;j<n;j++){
            cout<<marks[j]<<"\t\t";
        }
        cout<<"\n";
    }
    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