Gargit

Functions Exercise Part 12

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