/* Array in classes */
#include<iostream>
using namespace std;
class Sample
{
int a[100],n;
public:
void accept()
{
cout<<"\n\n Enter the number of elements to be inserted: ";
cin>>n;
cout<<"\n\n Enter "<<n <<" elements: ";
for(int i=0;i<n;i++)
{
cin>>a[i];
}
}
void display()
{
cout<<"\n\n Elements are: ";
for(int i=0;i<n;i++)
cout<<ends<<a[i];
}
};
int main()
{
Sample s;
s.accept();
s.display();
return 00;
}
#include<iostream>
using namespace std;
class Sample
{
int a[100],n;
public:
void accept()
{
cout<<"\n\n Enter the number of elements to be inserted: ";
cin>>n;
cout<<"\n\n Enter "<<n <<" elements: ";
for(int i=0;i<n;i++)
{
cin>>a[i];
}
}
void display()
{
cout<<"\n\n Elements are: ";
for(int i=0;i<n;i++)
cout<<ends<<a[i];
}
};
int main()
{
Sample s;
s.accept();
s.display();
return 00;
}