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
|
#include <iostream>
#include <array>
using namespace std;
const size_t arraySize = 20; //Standardizes array size. Const variable makes it unchangeable.
array <int , arraySize> array1 = {7, 21, 3, 99, 14, 65, 23, 44, 8, 19, 54,
33, 27, 89, 64, 31, 78, 92, 12, 11}; //First array
array <int , arraySize> array2 = {8, 92, 58, 61, 38, 27, 29, 41, 36, 15, 35,
67, 4, 7, 12, 71, 41, 37, 78, 21}; //Second array
array <int , arraySize> array3 = {}; //Third array, initialized to all zeroes?
void plusArrays()
{
for (size_t i = 0; i < arraySize; ++i)
array3[i] = array1[i] + array2[i];
}
int main()
{
void plusArrays();
cout << array3[1] <<endl;
return 0;
}
|