#include<iostream.h>
class student
{
char name[50],add[60];
int roll,grade;
public:
void getdata()
{
cout<<"Enter your name : ";
cin>>name;
cout<<"\nEnter your Roll no : ";
cin>>roll;
cout<<"\nEnter your Class : ";
cin>>grade;
cout<<"Enter your address : ";
cin>>add;
}
void display()
{
cout<<"\nname : "<<name;
cout<<"\nRoll no : "<<roll;
cout<<"\nAddress : "<<add;
cout<<"\nClass : "<<grade;
}
}s[10];
int main()
{
int i;
for(i=0;i<2;i++)
s[i].getdata();
for(i=0;i<2;i++)
{s[i].display();
}
return 0;
}
No comments:
Post a Comment