SCRIPT CODE
/* Agung Pambudi (c) 2013 ( afh4mz@gmail.com ) Date: 1-06-2013 Description: Program Penjumlahan 2 Matriks Ordo 2x2 */ #include<iostream> #include<conio.h> using namespace std; int i,x; int matriks_A[2][2], matriks_B[2][2], matriks_C[2][2]; char ulang; main() { cout<< "\nPenjumlahan 2 Matriks Ordo 2x2 \n\n"; do{ //Input data matriks A cout<< "\nData matriks A \n"; for(i=0; i<2; i++) { for(x=0; x<2; x++) { cout<< "["<<i<<"]["<<x<<"] : "; cin>> matriks_A[i][x]; } } cout<< "\n.__________________________________.\n"; //Input data matriks B cout<< "\nData matriks B \n"; for(i=0; i<2; i++) { for(x=0; x<2; x++) { cout<< "["<<i<<"]["<<x<<"] : "; cin>> matriks_B[i][x]; } } cout<< "\n.__________________________________.\n"; //Output hasil penjumlahan Matriks A + Matriks B cout<< "\nMatriks A + Matriks B : "<<endl; for(i=0; i<2; i++) { for(x=0; x<2; x++) { matriks_C[i][x]=matriks_A[i][x]+matriks_B[i][x]; cout<<"\t"<<matriks_C[i][x]; } cout<<endl; } cout<< "\n.__________________________________.\n"; cout<< "\nHitung lagi ? [y/t] : ";cin>>ulang; }while(ulang!='t'); cout<< "\n\nTerima Kasih \n\n"<<endl; getch(); } //END
makasih gan
ReplyDelete