ALGORITHM:
1.
Delcare class info with data members
name,age and weight and member functions setdata() and showdata()
2.
setdata()
i.
enter name
ii.
enter age
iii.
enter weight
3.
showdata()
i.
display name, age and weight
CODE
#include
#include
class
grp
{
char name[20];
int age;
int weight;
public:
void setdata(void)
{
cout<
cin>>name;
cout<
cin>>age;
cout<
cin>>weight;
}
void showdata()
{
cout<
cout<
cout<
}
};
void main()
{
clrscr();
grp s1;
s1.setdata();
s1.showdata();
getch();
}
No comments:
Post a Comment