News Update :
Home » , » MATRIKS 2 DIMENSI

MATRIKS 2 DIMENSI

Penulis : Unknown on Minggu, 22 Juli 2012 | 12.02


#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   int j;
   int i;
   int baris;
   int kolom;
   int matriks[100][100];
   int matriks2[100][100];
   int jumlah[100][100];

   raptor_prompt_variable_zzyz ="Masukkan Baris :";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> baris;
   raptor_prompt_variable_zzyz ="masukkan Kolom : ";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> kolom;
   i =1;
   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
         cout<<"Isi matriks A ke "<<i<<","<<j<<" = ";
         cin >> matriks[i][j];
         j =j+1;
      }
      i =i+1;
   }
   i =1;
   cout<<endl;
   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
        cout<<"Isi matriks B ke "<<i<<","<<j<<" = ";
         cin >> matriks2[i][j];
         j =j+1;
      }
      i =i+1;
   }
   i =1;
   cout<<endl;
   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
         jumlah[i][j] = matriks[i][j]*matriks2[i][j];
         j =j+1;
      }
      i =i+1;
   }
   cout << "Output Matriks A : " << endl;   i =1;
   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
            cout << setw (10);
         cout << matriks[i][j] <<" ";         j =j+1;
       
      }
      cout<<endl;
      i =i+1;
   }
   i =1;
   cout<<endl;
   cout << "Output Matriks B : " << endl;   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
            cout << setw (10);
         cout << matriks2[i][j] << " ";         j =j+1;
      }
      cout<<endl;
      i =i+1;
   }
   i =1;
   cout<<endl;
   cout << "Output Matriks A*B : " << endl;   while (!(i>baris))
   {
      j =1;
      while (!(j>kolom))
      {
            cout << setw (10);
         cout << jumlah[i][j] <<" ";         j =j+1;
      }
      cout<<endl;
      i =i+1;
   }

system("pause");
   return 0;
}

Share this article :
Comments to facebook

Posting Komentar

 
Copyright © 2011. .:: wahyudin 21 ::. . All Rights Reserved.
Design Template by panjz-online | Support by creating website | Powered by Blogger