Anda di halaman 1dari 2

Assignment 2

code :
#include <iostream>
using namespace std;
class student

{
string firstname ,fullname,address;
public:
showdata()
{
cout<<"first name="<<firstname<<"\t"<<"full name="<<fullname<<"\t"<<"address="<<address;
}

getdata()
{
cout<<"first name =";
cin>>firstname;
cout<<"full name =";
cin>>fullname;
cout<<"ADDRESS =";
cin>>address;

}
};
int main()
{
student s[5];
for(int i=0;i<5;i++)
{
cout <<"enter "<<i+1<<" student \n";
s[i].getdata();
}

cout<<"details of 5 student\n";
for(int i=0;i<5;i++)
{
s[i].showdata();
}

system("pause");
return 0;
}
output: