here are the instructions on the assignment
Create a function that receives array as an argument, and displays the two
dimensional array.
Create a function that receives arrays as arguments, and transforms the
input array. (See the example for how you need to transform)
Create a main function that initialize an array and invoke functions.
Section 1
Create a function that receives an array as an argument, and displays
the two dimensional array. (Displaying function)
Section 2
Create a function that receives two arrays as arguments, and
transforms the first array and store the result into the second array.
(Transforming function)
Section 3
Main function. Set a random number seed to 1 followed by the last 3
digits of your student ID. Declare two arrays, both 5 X 5 array.
Populate the first array with random numbers that are 2 digits long
(10 through 99).
Section 4
Invoke the Display function by passing the first array as argument.
Section 5
Invoke the Transforming function by passing two arrays as arguments.
Section 6
Invoke the Display function by passing the resulting array as argument.
*/
im stuck on the section 5 and 6 stuff.
here is what i have so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
void displayarray(int array1[5][5])
{
for (int row = 0; row < 5; row++)
{
for (int column = 0; column < 5; column++)
{
cout << array1[row][column] << ' ';
}
cout << endl;
} cout << endl;
}
// Section 2
void transformarray(int array1[5][5], int array2[5][5])
{
for (int row = 0; row < 5; row++)
{
for (int column = 4; column >= 0; column--)
{
array2[row][column];
}
} return array2;
}
// Section 3
int main()
{
srand(1354);
int array1[5][5], array2[5][5];
int size = 5;
for (int row = 0; row < size; row++)
{
for (int column = 0; column < size; column++)
{
array1[row][column] = (rand() % 89) + 10;
}
// Section 4
}displayarray(array1);
{
transformarray(array1, array2);
}
{
displayarray(array2);
}
}
|