1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <array>
using namespace std;
const size_t rows{10};
const size_t columns{2);
void printArray(const array<array<int, columns>, rows>&);
int main()
{
array<array,int, columns>, rows> arrayOne{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
array<array,int, columns>, rows> arrayTwo{21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40};
array<array<int, columns> rows> arraySum[20];
cout << "The values of array one are: " << endl;
printArray(arrayOne);
cout << "The values of array two are: " << endl;
printArray(arrayTwo);
arraySum[i] = arrayOne[i] + arrayTwo[i];
cout << " Sum of array one and two is: ";
printArray(arraySum);
}
}
|