#include<iostream.h>
#include<conio.h>
#include<process.h>
class stud
{
char name[30],add[30],city[30],state[30],country[30],email[30];
int roll,age;
long int contact;
public:
void accept(int);
void display();
void modify();
};
void stud::accept(int i)
{
cout<<"\nenter name,age,roll number,contact no.,address,city,state,country,emai-id for "<<i<<" student";
cin>>name>>age>>roll>>contact>>add>>city>>state>>country>>email;
}
void stud::modify()
{
int n;
while(1)
{
cout<<"\nenter 1. to modify name";
cout<<"\nenter 2. to modify age";
cout<<"\nenter 3. to modify roll number";
cout<<"\nenter 4. to modify contact no.";
cout<<"\nenter 5. to modify address";
cout<<"\nenter 6. to modify city";
cout<<"\nenter 7. to modify state";
cout<<"\nenter 8. to modify country";
cout<<"\nenter 9. to modify email address";
cout<<"\nenter 10 for exit";
cout<<"\nenter your choice";
cin>>n;
switch(n)
{
case 1:
cout<<"\nenter new name";
cin>>name;
break;
case 2:
cout<<"\nenter new age";
cin>>age;
break;
case 3:
cout<<"\nenter new roll number";
cin>>roll;
break;
case 4:
cout<<"\nenter new contact number";
cin>>contact;
break;
case 5:
cout<<"\nenter new address";
cin>>add;
break;
case 6:
cout<<"\nenter new city";
cin>>city;
break;
case 7:
cout<<"\nenter new state";
cin>>state;
break;
case 8:
cout<<"\nenter new country";
cin>>country;
break;
case 9:
cout<<"\nenter new email id";
cin>>email;
break;
case 10:
return;
default:
cout<<"\nentered a wrong choice";
}
}
}
void stud::display()
{
cout<<"\nname,age,roll number,contact number,address,city,state,country,email id-->\n";
cout<<name<<" "<<age<<" "<<roll<<" "<<contact<<" "<<add<<" "<<city<<" "<<state<<" "<<country<<" "<<email;
}
void main()
{
clrscr();
int t,i,s;
stud a[5];
while(1)
{
cout<<"\nenter 1. to input information for 5 students";
cout<<"\nenter 2. to modify information";
cout<<"\nenter 3. to display information";
cout<<"\nenter 4. to exit";
cout<<"\nenter your choice";
cin>>t;
switch(t)
{
case 1:
for(i=0;i<5;i++)
a[i].accept(i+1);
break;
case 2:
cout<<"\nenter the serial no.(from 1 to 5) whose information is to be modified";
cin>>s;
s--;
a[s].modify();
break;
case 3:
for(i=0;i<5;i++)
a[i].display();
break;
case 4:
exit(0);
default:
cout<<"\nentered a wrong choice";
}
}
}