#include <iostream>
using namespace std;
void addarrays(int*
f, int* s, int* th, int arrsize){
for(int i = 0; i < arrsize;
++i)
th[i] = f[i] + s[i];
}
int main(int argc, char*
argv[]){
const int SIZE = 5;
int first[5] = {19,72,3,41,5};
int second[5] = {5,22,35,4,4};
int third[5];
cout <<
"\nArray 1: ";
for(int i = 0; i < SIZE; ++i){
cout <<
first[i] << " ";
}
cout << "\nArray 2: ";
for(int i = 0; i < SIZE; ++i){
cout << second[i] << "
";
}
addarrays(first,second,third,SIZE);
cout
<< "\nSum of arrays: ";
for(int i = 0; i < SIZE; ++i){
cout << third[i] << " ";
}
char c;
cin
>> c;
}
Comments
Leave a comment