#include "stdafx.h"
#include <iostream>
#include <iomanip> // Habilitar la función ((IOMANIP))
using namespace std;
int main()
{
int i, j;
cout << "Suma de arreglos ingresados por el usuario" << endl;
int arre1[][3] = { 8, 2, 5,
3, 2, 2,
2, 2, 2};
int arre2[][3] = { 8, 2, 5,
3, 2, 2,
2, 2, 2};
int arreR[3][3];
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
arreR[i][j] = arre1[i][j] + arre2[i][j];
}
}
for (i = 0; i < 3; i++)
{
cout << endl;
for(j = 0; j < 3; j++)
{
cout << setw (5) <<arreR[i][j]; // funcion SETW, sirve para dar espacios entre cada columna del array
}
}
cout << endl; // manda el mensaje "Presione una tecla para continuar al siguiente renglon"
system("pause");
return 0;
}
No hay comentarios:
Publicar un comentario