Welcome to Home.

Monday, February 22, 2016

3 Dimensional Array in C++ : Sample Program

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int marks[2][4][3];
for(int i=0;i<2;i++)
{
for(int j=0;j<4;j++)
{
for(int k=0;k<3;k++)
{
cout<<"Enter:"<<i+1<<"Class:"<<j+1<<"No:"<<k+1<<"Marks:";
cin>>marks[i][j][k];
}
}
}
for(int l=0;l<2;l++)
{
for(int m=0;m<4;m++)
{
for(int n=0;n<3;n++)
{
cout<<l+1<<"Class:"<<m+1<<"No:"<<n+1<<"Marks:"<<marks[l][m][n];
}
}
}
getch();
}

No comments:

Post a Comment