Name Q1 Q2 Q3 Q4 Q5
Jean
Mark
Von 20
Ben
Jessie
Yno
#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;
}
Comments
Leave a comment