Thursday, October 16, 2014

Write a program to read value from an array and read it in C++

Prog 23: Write a program to read value from an array and read it.

#include<iostream.h>
#include<conio.h>
class array
{
int a[10];
public:
void getdata();
};
void array::getdata()
{
cout<<"\nenter value for an array";
for(int i=0;i<10;i++)
{
cin>>a[i];
}
}
void array::putdata()
{
cout<<"\n The array is";
for(int i=0;i<10;i++)
{
cout<<a[i]<<endl;
}
}
void main()
{
clrscr();
array a1;
a1.getdata();
a1.putdata();
getch();
}

No comments: