I'm having trouble doing this function for my code. Every time I copy an array into a 2d array instead of outputting all the values it only outputs the same value 4 times. For the alpha array, I input 20 numbers and for beta, I double the numbers from alpha.
void inputArray(int alpha[])
{
int i;
cout << "Enter 20 integers" << endl;
for (i = 0; i < 20; i++)
{
cin >> alpha[i];
}
cout << "Alpha after reading 20 numbers" << endl;
for (i = 0; i < 20; i++)
{
cout << alpha[i] << " ";
}
cout << endl;
}
double doubleArray(int beta[], int alpha[])
{
int i;
for (i = 0; i < 20; i++)
{
beta[i] = alpha[i] * 2;
}
cout << "Beta after a call to doubleArray" << endl;
for (i = 0; i < 20; i++)
{
cout << beta[i] << " ";
}
cout << endl;
return beta[20];
}
Write the definition of the function copyAlphaBeta that stores alpha
into the first five rows of inStock and beta into the last five rows of
inStock. Make sure that you prevent the function from modifying the
elements of alpha and beta.
And this the function I have a problem with.