0% found this document useful (0 votes)
5 views1 page

Struktur Data 1

This C++ program performs the addition of two 3x4 matrices. It prompts the user to input values for both matrices, computes their sum, and displays the resulting matrix. The program utilizes nested loops for input and output operations.

Uploaded by

Rahma Dhani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Struktur Data 1

This C++ program performs the addition of two 3x4 matrices. It prompts the user to input values for both matrices, computes their sum, and displays the resulting matrix. The program utilizes nested loops for input and output operations.

Uploaded by

Rahma Dhani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <iostream>

using namespace std;


int main() {
int ma[3][4], mb[3][4],mc[3][4];

cout<<"Program Penjumlahan matriks \n";


cout<<"--------------------------- \n";
cout<<"Input Matriks MA \n";
for(int x=0;x<=2;x++){
for(int y=0;y<=3;y++){
cout<<"ma-["<<x<<"]["<<y<<"] :";
cin>>ma[x][y];
}
}
cout<<"Input Matriks MB \n";
for(int x=0;x<=2;x++){
for(int y=0;y<=3;y++){
cout<<"mb-["<<x<<"]["<<y<<"] :";
cin>>mb[x][y];
}
}
//proses jumlah matriks
for(int x=0;x<=2;x++){
for(int y=0;y<=3;y++){
mc[x][y]=ma[x][y]+mb[x][y];
}
}
for(int x=0;x<=2;x++){
for(int y=0;y<=3;y++){
cout<<mc[x][y]<<" ";
}
cout<<endl;
}
return 0;
}

You might also like