Gargit

Functions Exercise Part 11

Aug 13th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. //Your function called MultiplyByIndex goes here
  4.  
  5. void AddTwoArrays(int inputArray[], int otherInputArray[], int outputArray[], int arraySize)
  6. {
  7.     for (int i = 0; i < arraySize; i++)
  8.     {
  9.         outputArray[i] = inputArray[i] + otherInputArray[i];
  10.         std::cout << outputArray[i] << ", ";
  11.     }
  12. }
  13.  
  14. int main()
  15. {
  16.     int first_integer_array[7] = { 10, 15, 7, 4, 13, 19, 8 };
  17.     int second_integer_array[7] = { 10, 15, 7, 4, 13, 19, 8 };
  18.     int output_array[7] = {};
  19.     AddTwoArrays(first_integer_array, second_integer_array, output_array, 7);  
  20.    
  21.     std::cout << std::endl;
  22.  
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment