WAP to create two different files name like roll and name of at least 5 students and print all on screen.
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
Comments
Leave a comment