//Nama : Muhammad Zuhri
//NIM : 2016140614
//Kelas : 04TPLP011
//Tugas Akhir Struktur Data Pertemuan 2.cpp
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
do
{
cout<<"Jumlah Baris =";
cin>>baris;
cout<<"Jumlah Kolom =";
cin>>kolom;
}
while
((baris>10)||(kolom>10));
cout<<"\nMatrix A"<<endl;
for(i=0; i<baris; i++)
for(j=0; j<kolom; j++)
{
cout<<"data ["<<i<<","<<j<<"]=";
cin>>m1[i][j];
}
cout<<"\nMatrix B"<<endl;
for(i=0; i<baris; i++)
for(j=0; j<kolom; j++)
{
cout<<"data["<<i<<","<<j<<"]=";
cin>>m2[i][j];
}
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]=m1[i][j]+m2[i][j];
cout<<endl;
cout<<"\tMatrix A + Matrix B = Matrix C\n ";
for (i=0; i<baris; i++)
{
cout<<"\n\t";
for (j=0; j<kolom; j++)
cout<<setw(4)<<m1[i][j];
cout<<" ";
for (j=0; j<kolom; j++)
cout<<setw(4)<<m2[i][j];
cout<<" ";
for (j=0; j<kolom; j++)
cout<<setw(4)<<hasil[i][j];
cout<<endl;
}
getch();
}
Hasil Outputnys seperti gambar dibawah ini :
Semoga materi struktur data ini bermanfaat bagi teman-teman yang membutuhkannya :)
Jumat, 01 Juni 2018
Home »
» Tugas Akhir Pertemuan 2 ARRAY
Tugas Akhir Pertemuan 2 ARRAY
Related Posts:
Tugas Akhir Pertemuan 13 QUEUE//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 13.cpp #include<iostream> #include<conio.h> #include<stdlib.h>… Read More
Tugas Akhir Pertemuan 12 STACK (Lanjut)//Nama : Muhammad Zuhri //NIM : 2016140614 //Kelas : 04TPLP011 //Tugas Akhir Struktur Data Pertemuan 12.cpp #include<iostream> #include<conio.h> using namespace std; m… Read More
Tugas Pendahuluan Pertemuan 12 STACK (Lanjut) Normal 0 false false false IN X-NONE X-NONE … Read More
Tugas Pendahuluan Pertemuan 11 STACK Normal 0 false false false IN X-NONE X-NONE … Read More
Tugas Pendahuluan Pertemuan 13 QUEUE Normal 0 false false false IN X-NONE X-NONE … Read More
Terima kasih.
BalasHapus