nah ini bagi yang pusing2 bikin script bagaikan benang kusut....mendingan contek az script ini...hahahah
#include <iostream>
#include <conio>
int main(){
typedef int matrik[100][100];
matrik a,b,c;
int x,y,d,e,f;
cout<<"\n masukkan jml matrik pertama =";cin>>d;
cout<<"\n masukkan jml marik kedua =";cin>>e;
cout<<"========================================"<<endl;
cout<<"1.penjumlahan"<<endl;
cout<<"2.perkalian"<<endl;
cout<<"========================================"<<endl;
cout<<" masukkan operator (1/2) :";cin>>f;
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
cout<<"matrik a["<<x<<"]["<<y<<"]=";
cin>>a[x][y];}
}cout<<endl;
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
cout<<"matrik b["<<x<<"]["<<y<<"]=";
cin>>b[x][y];
}
}cout<<endl;
if(f==1)
{
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
c[x][y]=a[x][y]+b[x][y];
}
}
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
cout<<"hasil = matrik c["<<x<<"]["<<y<<"]= "<<c[x][y]<<endl;
}}}
else if(f==2)
{
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
c[x][y]=a[x][y]*b[x][y];
}
}
for(x=0;x<d;x++)
{
for(y=0;y<e;y++)
{
cout<<"hasil = matrik c["<<x<<"]["<<y<<"]= "<<c[x][y]<<endl;
}}
}
getch();}