#include <iostream.h>
#include <conio.h>
void main()
{
int matrix[20][30], matrix2[2][3],jumlah[2][3];
int i, j;
cout<<"Matrix A :";
cout< <endl;
for (i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cout<<"Masukkan Nilai ["<<<"] ["<<<"] : ";
cin>>matrix[i][j];
}
}
void main()
{
int matrix[20][30], matrix2[2][3],jumlah[2][3];
int i, j;
cout<<"Matrix A :";
cout<
{
for(j=1;j<=2;j++)
{
cout<<"Masukkan Nilai ["<<<"] ["<
cin>>matrix[i][j];
}
}
cout<<"-----------------------------------------------------";
cout<<"\nMatrix B :\n";
for (i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cout<<"Masukkan Nilai ["<<<"] ["<<<"] : ";
cin>>matrix2[i][j];
}
}
cout<<"=====================================================";
for (i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
jumlah[i][j]=matrix[i][j] + matrix2[i][j];
}
}
gotoxy(1,16);
cout<<"C = ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(3+4*j,13+2*i);
cout< <matrix[i][j];
}
}
gotoxy(15,16);
cout<<" + ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(18+4*j,13+2*i);
cout< <matrix2[i][j];
}
}
gotoxy(30,16);
cout<<" = ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(33+4*j,13+2*i);
cout< <jumlah[i][j];
}
}
getch();
}
cout<<"\nMatrix B :\n";
for (i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cout<<"Masukkan Nilai ["<<<"] ["<
cin>>matrix2[i][j];
}
}
cout<<"=====================================================";
for (i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
jumlah[i][j]=matrix[i][j] + matrix2[i][j];
}
}
gotoxy(1,16);
cout<<"C = ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(3+4*j,13+2*i);
cout<
}
}
gotoxy(15,16);
cout<<" + ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(18+4*j,13+2*i);
cout<
}
}
gotoxy(30,16);
cout<<" = ";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
gotoxy(33+4*j,13+2*i);
cout<
}
}
getch();
}