#include <iostream.h>
#include <conio.h>
#include <iomanip.h>

class game {
typedef matrik[2][2];
matrik a, b, c;
int i, j;
public :
void masuk()
{
cout<<“\nMasukan Nilai Matriks”;
cout<<“\nMatriks A\n”;
for(i=0;i<2;i++){
for(j=0;j<2;j++){
cout<<“Masukan Matriks A [“<<i<<“][“<<j<<“] : “;cin>>a[i][j];}}
cout<<“\nMatriks B\n”;
for(i=0;i<2;i++){
for(j=0;j<2;j++){
cout<<“Masukan Matriks B [“<<i<<“][“<<j<<“] : “;cin>>b[i][j];}}
}
void simbol(){
gotoxy(20,18);
cout<<“+”;
gotoxy(41,18);
cout<<“=”;
}
void pertambahan()
{
for(i=0;i<2;i++){
for(j=0;j<2;j++){
c[i][j] = a[i][j] + b[i][j];}}

cout<<“\n    Matriks A      +     Matriks B      =     Matriks C”;
for(i=0;i<2;i++){

cout<<endl<<endl;
cout<<”  |”;
for(j=0;j<2;j++){
cout<<”   “<<a[i][j]<<setw(4);}
cout<<”  |”;

cout<<setw(8);
cout<<”  |”;
for(j=0;j<2;j++){
cout<<”   “<<b[i][j]<<setw(4);}
cout<<”  |”;

cout<<setw(8);
cout<<”  |”;
for(j=0;j<2;j++) {
cout<<”   “<<c[i][j]<<setw(4);}
cout<<”  |”;
}
}
};

int main(){
game ob;
ob.masuk();
ob.pertambahan();
ob.simbol();
getch();
return 0;}