I managed to multiply the numbers inside the array by 10 but my question
is how to insert the new multiplied numbers back into the array.
//write a function that multiplies each element in the array "myArray"
// by the variable "multiplyMe".
#include <iostream>
using namespace std;
// TODO - Write your function prototype here
int myFunction (int [], int, int);
int main()
{
const int SIZE = 10;
int myArray [SIZE] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50};
int multiplyMe = 5;
myFunction (myArray, SIZE, multiplyMe);
// TODO - Add your function call here
// print the array
for(int i=0; i < SIZE; i++)
{
cout << myArray[i] << " ";
}
cout << endl;
return 0;
}
// TODO - Write your function definition here
int myFunction (int myArray[], int SIZE, int multiplyMe)
{
int myNum;
for (int i = 0 ; i < SIZE ; i++)
{
myNum = myArray[i] * multiplyMe;
cout << myNum<<endl;
}
}
thank u