Gargit

Functions Exercise Part 10

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