Answer to Question #272500 in C++ for zgdhb

Question #272500

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


1
Expert's answer
2021-11-28T05:25:49-0500

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS