Source Code



Penjumlahan Matriks dengan array

  • Sulaeman Susanto
  • Jul 25' 13
  • C++
  • 57
  • 248
  • Indonesia

penjumlahan matriks dengan perintah array

#include <conio.h>
#include <iostream.h>

int main (){

int m1[100][100],m2[100][100],m3[100][100],baris,kolom,a,b,c,d;
   cout<<"
		========================================";
   cout<<"
			<< Penjumlahan Matriks >>";
   cout<<"
			<< Sulaeman susanto    >>";
   cout<<"
			<< SMK Telematika      >>";
   cout<<"
			<< support by pasarkode.com >>";
   cout<<"
		========================================";
   cout<<"
			";
   cout<<"

	Masukkan jumlah baris : "; cin>>baris;
   cout<<"

	Masukkan jumlah kolom : "; cin>>kolom;

//menginput matrik1
   cout<<"

>>>  Data Matriks A";
   for(a=0;a<baris;a++){
      cout<<"
	";
       for(b=0;b<kolom;b++){
      cout<<"
Masukkan data indeks  "<<a+1<<","<<b+1<<"  ="; cin>>m1[a][b];
       }
   }
   cout<<endl;

//menginput matrik2
   cout<<"

>>>  Data Matriks B";
   for(c=0;c<baris;c++){
      cout<<"
	";
       for(d=0;d<kolom;d++){
          cout<<"
Masukkan data indeks  = "<<c+1<<","<<d+1<<"  ="; cin>>m2[c][d];
       }
   }
cout<<endl;


//menampilkan matrik1
   cout<<"

>>> Data Matriks A

";
   for(a=0;a<baris;a++){
     cout<<"
	";
       for(b=0;b<kolom;b++){
          cout<<m1[a][b];
       }
   }
   cout<<"

";

//menampilkan matrik2
   cout<<"

>>>  Data Matriks B

";
   for(c=0;c<baris;c++){
      cout<<"
	";
       for(d=0;d<kolom;d++){
          cout<<m2[c][d];
       }
   }
   cout<<endl;

//untuk menghitung penjumlahan
    cout<<"

 >>>> Hasil Penjumlahan Kedua Matriks <<<< 

";
   for(a=0;a<baris;a++){
      cout<<"
	";
       for(b=0;b<kolom;b++){
          m3[a][b]=m1[a][b]+m2[a][b];
         cout<<m3[a][b];


       }
   }

     cout<<"

								pasarkode.com";

getch();
return 0;
}

  • Tags :
comments powered by Disqus

Related Code

Program suhu array 1 dimensi

Program Data Mahasiswa

Program mengurutkan angka genap dan ganjil

Membuat Program Bilangan Fibonacci

Program Bilangan Primer

Bilangan Faktorial

Program Segitiga Bintang

Program Bilangan Rata - Rata

Program menghitung bilangan urut

Membuat program Tahun Kabisat



Category