Enter Name & Age Then Display Using Class
#include
#include
class person
{
char name[30];
int age;
public:
void getdata();
void outdata();
};
void person::getdata()
{
cout<<"\nEnter Your Name";
cin>>name;
cout<<"\nEnter Your Age";
cin>>age;
}
void person::outdata()
{
cout<<"\nYour Name is "<
cout<<"\nYour Age is "<
}
void main()
{
clrscr();
person a;
a.getdata();
a.outdata();
getch();
}
OUTPUT
Enter Your Name Ankit
Enter Your Age 19
Your Name is Ankit
Your Age is 19
No comments:
Post a Comment