#define FIL 100
#define COL 100
#include <iostream>
using namespace std;
void leer(int, int, int[][COL], int [][COL]);
void calc(int, int, int[][COL], int [][COL], int[][COL]);
main()
{
    int a1[FIL][COL], a2[FIL][COL], a3[FIL][COL],f,c;
    system ("color F1");
    cout<<"Ingrese el numero de filas:";cin>>f;
    cout<<"Ingrese el numero de columnas:";cin>>c;
    leer(f,c,a1,a2);
    calc(f,c,a1,a2,a3);
    return system("pause");
}

void leer (int c, int f, int a1[FIL][COL], int a2[FIL][COL])
{
    int i, j;
    cout<<endl<<"Elementos de la Matriz A:"<<endl;
    for(i=0; i<f; i++)
    {
        for(j=0; j<c; j++)
        {
        cout<<"Leer Elemento ["<<i<<";"<<j<<"]:";cin>>a1[i][j];
        }
    }
        for (i=0 ; i<f; i++)
        {
            for(j=0; j<c; j++)
            cout<<a1[i][j]<<" ";
            cout<<endl;
        }
    cout<<endl<<"Elementos de la Matriz B:"<<endl;
    for(i=0; i<f; i++)
    {        for(j=0; j<c; j++)
        {
        cout<<"Leer Elemento ["<<i<<";"<<j<<"]:";cin>>a2[i][j];
        }
    }
        for (i=0 ; i<f; i++)
        {for(j=0; j<c; j++)
            cout<<a2[i][j]<<" ";
            cout<<endl;
        }
}
void calc (int f, int c, int a1[FIL][COL], int a2[FIL][COL], int a3[FIL][COL])
{
    int i,j;
    cout<<endl<<"Elementos de la Matriz C:"<<endl;
    for(i=0; i<f; i++)
    {for(j=0; j<c; j++)
    {
        a3[i][j]=a1[i][j]+a2[i][j];
        cout<<"El elemento ["<<i<<";"<<j<<"];";
        cout<<a3[i][j]<<endl;
    }
}
cout<<endl<<"La Matriz Resultante es:"<<endl;
for(i=0; i<f; i++)
{for(j=0; j<c; j++)
cout<<a3[i][j]<<" ";
cout<<endl;
}
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: