Sabtu, 26 November 2016

Jawanan Benar Logika Algoritma Program Pengurangan Dua Buah Matriks Pertemuan 9 BSI

Jawaban Benar Soal Logika Dan Algoritma BSI Pertemuan 9

Pengurangan Ke dua buah Matriks

Scrip :
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
main()
{

cout<<"Nama Kelompok :"<<endl;
cout<<"No        NIM            Nama"<<endl;
cout<<"1.         12164296        Sugiyanti"<<endl;
cout<<endl;
cout<<"Kelas            :12.1B.09"<<endl;
cout<<endl;
int i,j;
int matriks1[2][3];
int matriks2[2][3];
int matriks3[2][3];
char lagi;

atas:
cout<<"======================================="<<endl;
cout<<"Operasi Pengurangan Matriks"<<endl;
cout<<"======================================="<<endl;
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
cout<<" Masukkan nilai ke - "<<i<<" "<<j<<" ";
cin>>matriks1[i][j];
}
}
cout<<"\n Matriks 1 \n";
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
cout<<setiosflags(ios::left)<<setw(3)<<matriks1[i][j];
}
cout<<"\n";
}
cout<<"\n";

for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
cout<<" Masukkan nilai ke - "<<i<<" "<<j<<" ";
cin>>matriks2[i][j];
}
}
cout<<"\n Matriks 2 \n";
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
cout<<setiosflags(ios::left)<<setw(3)<<matriks2[i][j];
}
cout<<"\n";
}
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
matriks3[i][j]=matriks1[i][j]-matriks2[i][j];
}
}
cout<<"\n Pengurangan Matrix \n";
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
cout<<setiosflags(ios::left)<<setw(3)<<matriks3[i][j];
}
cout<<"\n";
}

bawah:
printf("\n\nIngin Hitung Lagi [Y/T] : \n");
lagi = getche() ;
if (lagi == 'Y' || lagi == 'y')
goto atas; // penggunaan label
getch();
}

Hasil :



Semoga bermanfaat ...:)
GOD BLESS.

Tidak ada komentar:

Posting Komentar