Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int F = 0, C = 0;
- cout << "Total de Filas de las matrices: ";
- cin >> F;
- cout << "Total de Filas de las matrices: ";
- cin >> C;
- int matriz1[F][C];
- int matriz2[F][C];
- int matriz3[F][C*2];
- cout << "Ingresar los valores para la matriz 1" << endl;
- for(int i = 0; i < F; i++)
- for(int j = 0; j < C; j++)
- {
- cout << "Ingresa valor en la posicion [" << i << "," << j << "]: ";
- cin >> matriz1[i][j];
- matriz3[i][j] = matriz1[i][j];
- }
- cout << endl << "Ingresar los valores para la matriz 2" << endl;
- for(int i = 0; i < F; i++)
- for(int j = 0; j < C; j++)
- {
- cout << "Ingresa valor en la posicion [" << i << "," << j << "]: ";
- cin >> matriz2[i][j];
- matriz3[i][j+C] = matriz2[i][j];
- }
- cout << endl << "Matriz 1" << endl;
- for(int i = 0; i < F; i++)
- {
- for(int j = 0; j < C; j++)
- cout << matriz1[i][j] << " ";
- cout << endl;
- }
- cout << endl << "Matriz 2" << endl;
- for(int i = 0; i < F; i++)
- {
- for(int j = 0; j < C; j++)
- cout << matriz2[i][j] << " ";
- cout << endl;
- }
- cout << endl << "Suma [Matriz1+Matriz2]" << endl;
- for(int i = 0; i < F; i++)
- {
- for(int j = 0; j < C*2; j++)
- cout << matriz3[i][j] << " ";
- cout << endl;
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement