Programa suma de matrices
using namespace std;
int row,fil,i,j;
int main()
{
cout<<endl<<endl<<" ESTE PROGRAMA SUMA Y RESTA MATRICES"<<endl<<" DE 'N' COLUMNAS Y 'M' FILAS"<<endl<<endl;
system("pause");
system("cls");
cout <<"Cuantas filas tendran las matrices? ";cin >>fil;
cout<<endl<<"Cuantas columnas tendra tu matrices? ";
cin >>row;
cout<<endl<<endl<<"En la matriz A ingresa elvalor de la posicion:"<<endl;
int matriz1[fil][row];
for (i=0;i<=fil-1;i++)
{
for (j=0;j<=row-1;j++)
{cout<<"("<<i+1<<")"<<"("<<j+1<<"): ";
cin >>matriz1[i][j];
}
}
cout<<endl;
system("pause");cout<<endl<<endl<<"En la matriz B ingresa el valor de la posicion:"<<endl;
int matriz2[fil][row];
for (i=0;i<=fil-1;i++)
{
for(j=0;j<=row-1;j++)
{
cout<<"("<<i+1<<")"<<"("<<j+1<<"): ";
cin >>matriz2[i][j];
}
}cout<<endl;
system("pause");
cout<<endl<<endl;
int matriz3[fil][row];
for (i=0;i<=fil-1;i++)
{
for (j=0;j<=row-1;j++){
matriz3[i][j]= matriz1[i][j]+matriz2[i][j];
cout << "Valor posicion "<<"("<<i+1<<")"<<"("<<j+1<<"):"<<matriz3[i][j]<<endl;
}
}
cout <<endl<<"Gracias por usar este programa "<<endl<<endl;
system("pause");
return 0;
}
Regístrate para leer el documento completo.