CARA MEMBUAT PROGRAM ARRAY 3 DIMENSI DENGAN C++
CARA MEMBUAT PROGRAM ARRAY 3 DIMENSI DENGAN C++
LANGSUNG TKP
simpan program dibawah ini dengan array3d.cpp
Script
#include <iostream>
#include <iomanip>
using namespace std;
main()
{
int a,s,d;
int nilai[2][4][3]=
{
{
{100,200,300},
{150,240,360},
{250,340,460},
{250,340,460}},
{{160,250,365},
{175,275,375},
{275,375,575},
{380,480,580}
},
};
int m=1;
cout<<"|-----------------------------------------|"<<endl;
cout<<"| |
| Tahun Penjualan |"<<endl;
cout<<"|Tahun |
Hasil |------------------------|"<<endl;
cout<<"| Ke |
Ke | 2002 | 2003 | 2004 |"<<endl;
cout<<"|-----------------------------------------|"<<endl;
for(a=0; a<2; a++)
{
for(s=0; s<4; s++)
{
cout<<" "<<a+1
<<"\t"<<"
" <<s+1 <<"\t"<<" ";
for
(d=0; d<3; d++)
{
cout<<nilai[a][s][d]
<<" ";
}
cout
<<endl;
}
cout<<"\n";
}
cout<<"\n";
}
Output
CARA MEMBUAT PROGRAM ARRAY 3 DIMENSI DENGAN C++
Reviewed by Unknown
on
23:32
Rating:
No comments: