You are on page 1of 2

2D Array Class

============================================
#include <iostream.h>
#include <stdlib.h>

class Array{

public:

void set(int b[][3])


{
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
a[i][j]=b[i][j];
}

void display()
{
system("cls");
cout<<endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++)
cout<<a[i][j]+a[i][j]<<' ';
cout<<endl;
}

}
private:
int a[3][3];

};

void main()
{
Array ar;

int a[3][3];
cout<<"Enter the 2D Array: ";
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
cin>>a[i][j];
ar.set(a);

ar.display();
cout<<endl<<endl;
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006