#include<iostream>
using namespace std;
class Person
{
int age;
char name[10];
public:
void getdata();
void putdata();
};
void Person::getdata()
{
cout<<"\nEnter name:";
cin>>name;
cout<<"Enter age:";
cin>>age;
}
void Person::putdata()
{
cout<<"\nName:"<<name<<endl;
cout<<"Age :"<<age<<endl;
}
int main()
{
Person p;
p.getdata();
p.putdata();
return 0;
}
using namespace std;
class Person
{
int age;
char name[10];
public:
void getdata();
void putdata();
};
void Person::getdata()
{
cout<<"\nEnter name:";
cin>>name;
cout<<"Enter age:";
cin>>age;
}
void Person::putdata()
{
cout<<"\nName:"<<name<<endl;
cout<<"Age :"<<age<<endl;
}
int main()
{
Person p;
p.getdata();
p.putdata();
return 0;
}
No comments:
Post a Comment