Practical 27
#include <iostream>
using namespace std;
class Person
{
string name;
public:
void getdata()
{
cout<<"\nEnter Name:";
cin>>name;
}
void putdata()
{
cout<<"\nYour name :"<<name;
}
};
int main()
{
int n;
Person *persptr[10];
cout<<"\nHow Many Names:";
cin>>n;
using namespace std;
class Person
{
string name;
public:
void getdata()
{
cout<<"\nEnter Name:";
cin>>name;
}
void putdata()
{
cout<<"\nYour name :"<<name;
}
};
int main()
{
int n;
Person *persptr[10];
cout<<"\nHow Many Names:";
cin>>n;
for(int i=0;i<n;i++)
{
persptr[i] = new Person;
persptr[i]->getdata();
}
for(int i=0;i<n;i++)
{
persptr[i]->putdata();
}
return 0;
}
No comments:
Post a Comment