Selamat datang di maiav3.blogspot.com => Blog "TANPO ASMO"

SCRIPT C++_MATRIKS

Jumat, 18 Januari 20131komentar


//program matriks
//created by maiaachiea

#include <iostream.h>

void main(){
int M1[10][10];
int M2[10][10];
int M3[10][10];
int M4[10][10];
int M5[10][10];
int M6[10][10];
int i,j,x,y;
cout<<"*======================================*"<<endl;
cout<<"*\tMASUKKAN DIMENSI MATRIKS :     *"<<endl;
cout<<"*======================================*"<<endl;
cout<<"\t";
cin>>y;
cout<<"\t";
cin>>x;
cout<<"*======================================*"<<endl;

cout<<"\tMASUKKAN MATRIKS PERTAMA :"<<endl;
for (i=1;i<=x;i++){
 for (j=1;j<=y;j++){
cout<<"\t";
cin>>M1[i][j];}}

cout<<"\tMASUKKAN MATRIKS KEDUA :"<<endl;
for (i=1;i<=x;i++){
 for (j=1;j<=y;j++){
cout<<"\t";
cin>>M2[i][j];}}
cout<<"*======================================*"<<endl;

for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
M3[i][j]=M1[i][j]+M2[i][j];}}

for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
M4[i][j]=M1[i][j]-M2[i][j];}}

for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
M5[i][j]=M1[i][j]*M2[i][j];}}

for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
M6[i][j]=M1[i][j]/M2[i][j];}}

cout<<"\tMATRIKS PERTAMA :"<<endl;
for (i=1;i<=x;i++){
 for (j=1;j<=y;j++){
cout<<"\t";
cout<<M1[i][j]<<" ";}
cout<<endl;}

cout<<"\tMATRIKS KEDUA :"<<endl;
for (i=1;i<=x;i++){
 for (j=1;j<=y;j++){
cout<<"\t";
cout<<M2[i][j]<<" ";}
cout<<endl;}
cout<<"*======================================*"<<endl;
cout<<"\tHASIL PERTAMBAHAN : "<<endl;
for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
cout<<"\t";
cout<<M3[i][j]<<" ";}
cout<<endl;}

cout<<"\tHASIL PENGURANGAN : "<<endl;
for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
cout<<"\t";
cout<<M4[i][j]<<" ";}
cout<<endl;}

cout<<"\tHASIL PERKALIAN : "<<endl;
for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
cout<<"\t";
cout<<M5[i][j]<<" ";}
cout<<endl;}

cout<<"\tHASIL PEMBAGIAN : "<<endl;
for(i=1;i<=x;i++){
 for(j=1;j<=y;j++){
cout<<"\t";
cout<<M6[i][j]<<" ";}
cout<<endl;}
cout<<"*======================================*"<<endl;


}
Share this article :

+ komentar + 1 komentar

18 Januari 2013 pukul 20.50

semoga bermanfaat buat teman-teman semua... ^_^

Posting Komentar

 
Support : Maia Achiea Template
Copyright © 2011. .: ^_^ :. - All Rights Reserved
Proudly powered by Blogger