Senin, 14 Juni 2010

Pemrograman C++ Array 2 Dimensi

Buzz It

Pemrograman C++ Array 2 Dimensi

//Array 3 Dimensi



//==================================================

#include<conio.h>

#include<stdio.h>

#include<iostream.h>

#include<iomanip.h>



void main()

{

clrscr();

int I,j,k;

float data[2][4][3]=

{

{

{110,120,250},

{115,125,260},

{120,130,265},

{125,135,270}

},

{

{210,320,450},

{215,325,460},

{220,330,465},

{225,335,470}

},

};

cout<<”============================================”;

cout<<endl;

cout<<”Tahun Hasil Tahun Penjualan “;

cout<<endl;

Cout<<”Ke. Ke. =======================================”;

cout<<endl;

cout<<” 2008 2009 2010”;

cout<<endl;

cout<<”============================================”;

cout<<endl;

for(i=0; i<2; i++)

{

for(j=0; j<4; j++)

{

cout<<setiosflag(ios::left)<<setw(10)<<i+1;

cout<<setiosflag(ios::left)<<setw(10)<<j+1;

for(k=0; k<3; K++)

{

cout<<setiosflag(ios::right)<<setw(10);

cout<<data[i][j][k];

cout<<” “;

}

cout<<endl;

}

cout<<endl;

}

cout<<”============================================”;

cout<<endl;

getche();

}

Sumber : Praktikum STMIK Mercusuar | Download Artikel.