penjumblahan 2 buah matrik di c++

hello friends this time I’m learning about matrices in c + +. just the introduction of the matrix that is the type of structured data consisting of a number of components that have the same data type .. and this time I will give you listing program in c + + using matrix addition

check this out »>

#include <iostream.h>

#include <conio.h>

#include <iomanip.h>

int A[2][2],B[2][2],C[2][2];

void inputmatriksA()

{cout«”Matriks A”«endl;

for (int i=0;i<2;i++)

for (int j=0;j<2;j++)

{cout«”Elemen A [“«(i+1)«”,”«(j+i)«”]:”;

cin»A[i][j];}}

void inputmatriksB()

{cout«”Matriks B”«endl;

for (int i=0;i<2;i++)

for (int j=0;j<2;j++)

{cout«”Elemen B [“«(i+1)«”,”«(j+i)«”]:”;

cin»B[i][j];}}

void tampilA()

{cout«”Matriks A”«endl;

for (int i=0;i<2;i++)

{for (int j=0;j<2;j++)

cout«setw(2)«A[i][j]«” “;

cout«endl;}}

void tampilB()

{cout«”Matriks B”«endl;

for (int i=0;i<2;i++)

{for (int j=0;j<2;j++)

cout«setw(2)«B[i][j]«” “;

cout«endl;}}

void tampilC()

{cout«”Jumlah Matriks A & B”«endl;

for (int i=0;i<2;i++)

{for (int j=0;j<2;j++)

cout«setw(2)«C[i][j]«” “;

cout«endl;}}

void Jumlah()

{for (int i=0;i<2;i++)

{for (int j=0;j<2;j++)

C[i][j]=A[i][j]+B[i][j];

cout«endl;}}

void main()

{clrscr();

cout«”  Penjumlahan 2 Buah Matriks  ”«endl;

cout«”=======================================”«endl;

inputmatriksA();

cout«”=======================================”«endl;

inputmatriksB();

cout«”=======================================”«endl;

cout«endl;

clrscr();

cout«”  tTampilan Matriks A  ”«endl;

cout«”======================================================”«endl;

tampilA();

cout«”  ntTampilan Matriks B  ”«endl;

cout«”======================================================”«endl;

tampilB();

Jumlah();

cout«”  nMaka Penjumlahan dari matriks diatas adalah  ”«endl;

cout«”======================================================”«endl;

tampilC();

getch();

}

This entry was posted in semester1 and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s