Multidimensional Array in C++ Language.

#include <iostream.h>
#include <iomanip>
#include <conio.h>
void main()
{
int a[2][2][4];
for(int r=0; r<2; r++)
{
for(int c=0; c<2; c++)
{
for(int w=0; w<4; w++)
{
cout<<"Enter the Value for an Array:  ";
cin>>a[r][c][w];
}
}
}
for(int r1=0; r1<2; r1++)
{
for(int c1=0; c1<2; c1++)
{
for(int w1=0; w1<4; w1++)
{
cout<<a[r1][c1][w1]<<setw(7);
}
cout<<endl;
}
}
getch();
}

Output Result:

Post a Comment

Total Pageviews