/* Array within Classes */
#include<iostream>
using namespace std;
class Sample
{
int a[5];
public:
void accept();
void display();
};
void Sample::accept()
{
cout<<"\n\n Enter any 5 number: ";
for(int i=0;i<5;i++)
cin>>a[i];
}
void Sample::display()
{
cout<<"\n\n 5 Number: ";
for(int i=0;i<5;i++)
cout<<a[i]<<ends;
}
int main()
{
Sample s;
s.accept();
s.display();
return 0;
}
#include<iostream>
using namespace std;
class Sample
{
int a[5];
public:
void accept();
void display();
};
void Sample::accept()
{
cout<<"\n\n Enter any 5 number: ";
for(int i=0;i<5;i++)
cin>>a[i];
}
void Sample::display()
{
cout<<"\n\n 5 Number: ";
for(int i=0;i<5;i++)
cout<<a[i]<<ends;
}
int main()
{
Sample s;
s.accept();
s.display();
return 0;
}