Question #272500

WAP to create two different files name like roll and name of at least 5 students and print all on screen.


Expert's answer

Source code

#include <iostream>


using namespace std;


int main()
{
    int n;
    cout<<"\nEnter number of student: ";
    cin>>n;
    
    string names[n];
    int roll[n];
    
    for(int i=0;i<n;i++){
        cout<<"\nEnter details of student "<<(i+1)<<":";
        cout<<"\nName: ";
        cin>>names[i];
        cout<<"\nRoll: ";
        cin>>roll[i];
    }
    cout<<"\nName\tRoll";
    for(int i=0;i<n;i++){
        cout<<"\n"<<names[i]<<"\t"<<roll[i];
    }


    return 0;
}


Output






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!

LATEST TUTORIALS
APPROVED BY CLIENTS