Monday, June 4, 2018

CONTOH PROGRAM PENJUMLAH PADA MATRIKS


CONTOH SOURCE CODE BORLAND C++
CONTOH PROGRAM PENJUMLAH PADA MATRIKS

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

main ()
{
            int A [2][3];
   int B [2][3];
   int C [2][3];
   int D [2][3];
   int i;
   int j;
            clrscr();
   cout<<"MATRICK A DAN B\n\n";
   i=0;
   while (i<2)
   {
            j=0;
      while (j<3)
      {
            cout<<"A["<<i<<"]["<<j<<"]=";cin>>A[i][j];
         cout<<"B["<<i<<"]["<<j<<"]=";cin>>B[i][j];
         j=j+1;
      }
      cout<<endl;
      i=i+1;
      }
        i=0;
        while (i<2)
        {
                        j=0;
            while (j<3)
            {
            C[i][j]=A[i][j]+B[i][j];
            D[i][j]=A[i][j]-B[i][j];
            j=j+1;
            }
            cout<<endl;
            i=i+1;
            }
            i=0;
            cout<<"HASIL MATRICK C (penjumlahan) DAN D (pengurangan)\n\n";
                                    while (i<2)
                                    {
                                                j=0;
                                    while (j<3)
                                    {
                                                cout<<"C["<<i<<"]["<<j<<"]="<<C[i][j]<<endl;
                  cout<<"D["<<i<<"]["<<j<<"]="<<D[i][j]<<endl;
                                    j=j+1;
                                                }
                                                            cout<<endl;
                     i=i+1;
                                                            }
getch();
}

No comments:

Post a Comment

CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++

CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++ #include<stdlib.h> #include<conio.h> #include<iostream.h> struc...