Kamis, 25 April 2013
Contoh Program C++ (Penjumlahan Matriks 3x3)
#include<iostream.h>
void main()
{
int a[4][4],b[4][4],c[4][4];
int saya,anda;
cout<<"masukan anggota matriks A = "<<endl;
for(saya=0; saya<=3; saya++)
{
for(anda=0; anda<=3; anda++)
{
cin>>a[saya][anda];
}
cout<<endl;
}
cout<<"---------"<<endl;
cout<<"Matriks A"<<endl;
cout<<"---------"<<endl;
for (saya=0; saya<=3; saya++)
{
for (anda=0; anda<=3; anda++)
{
cout<<a [saya][anda]<<" ";
}
cout<<endl;
}
cout<<endl;
cout<<"Masukan Komponen Matriks B:"<<endl;
for (saya=0;saya<=3;saya++)
{
for (anda=0;anda<=3;anda++)
{
cin>> b [saya][anda];
}
cout<<endl;
}
cout<<"---------"<<endl;
cout<<"Matriks B"<<endl;
cout<<"---------"<<endl;
for(saya=0;saya<=3;saya++)
{
for (anda=0;anda<=3;anda++)
{
cout<<b [saya][anda]<<" ";
}
cout<<endl;
}
cout<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"Hasil Dari Penjumlahan Matriks A dan B"<<endl;
cout<<"--------------------------------------"<<endl;
for (saya=0; saya<=3; saya++)
{
for (anda=0;anda<=3; anda++)
{
c [saya][anda]= a [saya][anda]*b [saya][anda];
cout<<c [saya][anda]<<" ";
}
cout<<endl;
}
}
Langganan:
Posting Komentar (Atom)
Hard Rock Casino & Hotel Map & Floor Plans - Mapyro
BalasHapus› › Hard 아산 출장마사지 Rock › 과천 출장안마 › Hard Rock Hard 양주 출장샵 Rock Hard Rock's Casino and Hotel information page also provides 구리 출장안마 floor plans, floor plans, floor plans, photos, floor plans, floor plans, 화성 출장안마 reviews,