#include<iostream.h>
#include<conio.h>
class array
{
private:
int a[10],max;
public:
void read();
void display();
};
void array::read()
{
cout<<
"Enter limit of array : ";
cin>>max;
cout<<"Enter "<<max<<" elements into array : ";
for(int i=0;i<max;i++)
cin>>a[i];
}
void array::display()
{
cout<<"Elements in the array are : ";
for(int i=0;i<max;i++)
cout<<a[i]<<" ";
}
void main()
{
clrscr();
array a;
a.read();
a.display();
getch();
}
No comments:
Post a Comment