Program C++ Array Lanjut

//array lanjut

//28 nov

//heppy

#include <iostream>

using namespace std;

 

//kamus

int g,h,K,L,M;

int Nilai[5];

int TabA[3],TabB[3],TabHsl[3];

int f;

int MatA[2][3], MatB[2][3],MatTot[2][3];

int BRS,KLM;

//desk

int main () {

 

cout<<"==========ARRAY LANJUT=========="<<endl;

/*

cin>>g;

cin>>h;

cin>>K;

cin>>L;

cin>>M;

 

cout<<"==========ARRAY LANJUT=========="<<endl;

cout << g <<endl;

cout << h <<endl;

cout << K <<endl;

cout << L <<endl;

cout << M <<endl;

 

cout<<"==========DATA LARIK=========="<<endl;

//static

Nilai[0] = 4;

Nilai[4] = 3;

 

//dinamic

cin>>Nilai[2];

cin>>Nilai[3];

 

//cetak

cout << Nilai[2] <<endl;

cout << Nilai[1] <<endl;

cout << Nilai[0] <<endl;

cout << Nilai[3] <<endl;

 

 

cout << "Ngisi Tabel A" << endl;

cin >> TabA[1];

cin >> TabA[0];

cin >> TabA[2];

 

TabB[1] = 3;

TabB[0] = 6;

TabB[2] = 1;

 

f=0;

do{

    TabHsl[f] = TabA[f] + TabB[f];

    cout << TabHsl;

    f = f + 1;

}while(f<3);

*/

MatB[0][1] = 3;

MatB[0][0] = 6;

MatB[1][1] = 8;

MatB[1][2] = 9;

MatB[0][2] = 1;

MatB[1][0] = 7;

 

BRS = 0;

while (BRS<3){

    KLM=0;

    do

    {

        cin >> MatA[KLM][BRS];

        cin >> MatB[KLM][BRS];

        MatTot[KLM][BRS] = MatA[KLM][BRS] + MatB [KLM][BRS];

        cout << MatTot[KLM][BRS] << " " ;

        KLM = KLM + 1;

    }while(KLM<2);

    cout << endl;

    BRS=BRS + 1;

}

}


Komentar

Postingan populer dari blog ini

Contoh Program C++ Menghitung Kelipatan 6

UNIVERSITAS DIAN NUSWANTORO SEMARANG (www.dinus.ac.id)

Program C++ Vockons