14 November 2011

A program in class array (C++)

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class array
{
private:
int arr1[5];
public:
void getdata();
void putdata();

};
void array::getdata()
{
for(int i=0;i<=4;i++)
{
cout<<"\n Enter the number :";
cin>>arr1[i];
}
}
void array::putdata()
{
for(int i=0;i<=4;i++)
{
cout<<"\n"<<arr1[i];
}
}
void main()
{
array a;
clrscr();
a.getdata();
a.putdata();
getch();
}

0 comments:

Post a Comment