Program c++ Konsep Input Output Array 2 Dimensi
Saturday, June 3, 2017
Add Comment
#include <iostream.h>
#include <conio.h>
#define ROWS 3
#define COLS 2
void main()
{
int tahun= 2010;
int cell = 10;
int penjualan[ROWS][COLS];
//input data penjualan
for (int i=0; i < ROWS; i++)
{
cout << "\nPenjualan Tahun " << i+tahun;
cout << "\n--------------------\n";
for (int j=0; j < COLS; j++)
{
cout << "Data ke-" << j+1;
cout << " = ";
cin >> penjualan[i][j];
}
}
//cetak header tabel
cout <<endl<<endl;
cout << "Data penjualan pertahun\n";
cout << "-----------------------\n";
//output data penjualan
for (int i=0; i < ROWS; i++)
{ cout << "\nTahun " << tahun+i;
cout << "\n----------------\n";
for (int j=0; j < COLS; j++)
{ cout << j+1 << ") ";
cout << penjualan[i][j] << endl;
}
}
getch();
}
Source: www.gatewan.com
0 Response to "Program c++ Konsep Input Output Array 2 Dimensi"
Post a Comment