P. 1
Koding Menu Matriks

Koding Menu Matriks

|Views: 247|Likes:
Published by Arbi Yoan

More info:

Published by: Arbi Yoan on Feb 29, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

11/15/2014

pdf

text

original

1.

Buatlah program dengan array 2 dimensi dan looping untuk menjumlahkan,
mengurangkan dan mengalikan dua buah matrik berorde 3x3. Program dibuat dengan
menu untuk menginputkan data matrik, melakukan penjumlahan, pengurangan dan
perkalian dengan contoh menu sebagai berikut:
Menu operasi matrik 3x3
1. nput matrik
2. !ampil matrik
3. Penjumlahan matrik
". Pengurangan matrik
#. Perkalian matrik
$. %eluar
nput pilihan &
#include <iostream.h>
#include <conio.h>
int m1[3][3],m2[3][3];
int input()
{
clrscr();
cout<<"n matri!s pertama n";
"or(int i#1;i<#3;i$$)
{
"or(int %#1;%<#3;%$$)
{
cout<<"$ elemen ["<<i<<","<<%<<"]#";cin>>m1[i][%];
&
&
cout<<"n matri!s !edua n";
"or(int '#1;'<#3;'$$)
{
"or(int (#1;(<#3;($$)
{
cout<<"$ elemen ["<<'<<","<<(<<"]#";cin>>m2['][(];
&
&
return );
&
int tampil()
{
clrscr();
cout<<"* matri! pertama +n";
"or(int i#1;i<#3;i$$)
{
"or(int %#1;%<#3;%$$)
{
cout<<" "<<" ";
cout<<m1[i][%];
&
cout<<"n";
&
cout<<"nn";
cout<<"* matri!s !edua +n";
"or(int '#1;'<#3;'$$)
{
"or(int (#1;(<#3;($$)
{
cout<<" "<<" ";
cout<<m2['][(];
&
cout<<"n";
&
return );
&
int pen%umlahan()
{
int ';
tampil();
cout<<"n* pen%umlahan matri!s n";
"or(int i#1;i<#3;i$$)
{
"or(int %#1;%<#3;%$$)
{
'#m1[i][%]$m2[i][%];cout<<';
cout<<" "<<" ";
&
cout<<"n";
&
return );
&
int pen,uran,an()
{
int ';
tampil();
cout<<"n* pen,uran,an matri!s n";
"or(int i#1;i<#3;i$$)
{
"or(int %#1;%<#3;%$$)
{
'#m1[i][%]-m2[i][%];cout<<';
cout<<" "<<" ";
&
cout<<"n";
&
return );
&
int per!alian()
{
int .;
tampil();
cout<<"n* per!alian matri!s n";
"or(int i#1;i<#3;i$$)
{
"or(int %#1;%<#3;%$$)
{
.#(m1[i][1]*m2[1][%]$m1[i][2]*m2[2][%]$m1[i][3]*m2[3][%]);cout<<.;
cout<<" "<<" ";
&
cout<<"n";
&
return );
&
main()
{
int pil;
pil#1;
/hile(pil0#1){
clrscr();
cout<<"n########2345 56727##########n";
cout<<"1. input matri!sn";
cout<<"2. tampil!an matri!sn";
cout<<"3. pen%umlahann";
cout<<"8. pen,uran,ann";
cout<<"9. per!aliann";
cout<<"1. !eluarn";
cout<<"############################n";
cout<<"pilihan anda + ";cin>>pil;
s/itch(pil){
case 1+{
input();:rea!;
&
case 2+{
tampil();:rea!;
&
case 3+{
pen%umlahan();:rea!;
&
case 8+{
pen,uran,an();:rea!;
&
case 9+{
per!alian();:rea!;
&
&
,etch();
&
return );
&

for(int i=1. } return 0. } cout<<"\n". } cout<<"\n\n".j<=3. tampil(). } . } return 0. } return 0. cout<<" "<<" ". } cout<<"\n". cout<<"* matriks kedua :\n". tampil().j++) { x=m1[i][j]+m2[i][j]. } int penjumlahan() { int x. for(int i=1. cout<<" "<<" ". cout<<"\n* pengurangan matriks \n".i++) { for(int j=1.cout<<x.j<=3.for(int j=1. } cout<<"\n".j<=3.i++) { for(int j=1.x<=3. cout<<m2[x][y].i<=3.x++) { for(int y=1.y<=3. cout<<"\n* penjumlahan matriks \n". cout<<m1[i][j].y++) { cout<<" "<<" ". } cout<<"\n".i<=3. for(int x=1.j++) { cout<<" "<<" ". } int pengurangan() { int x.j++) { x=m1[i][j]-m2[i][j].cout<<x.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->