Program c++ Konsep Input Output Array 2 Dimensi

Contoh C++ Datalog Penjualan
Contoh C++ Datalog Penjualan


Source Code:
#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

Subscribe to receive free email updates:

0 Response to "Program c++ Konsep Input Output Array 2 Dimensi"

Posting Komentar