Stuck on how to finish transform function.

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);
	}
}
What does "transformation" mean? What should the "transform array" actually do?
could someone explain to me or write the transform function i need to complete this? Have tried to do it the way he wants in Sections 5 and 6 but no luck....
We cannot explain any of it (yet), because you have not told what does it mean to "transform". Only you have that information.
It looks like line 40 is section 5 and line 43 is section 6.

Line 23 is wrong because the function is not supposed to return anything. Array2 is being modified in place because you passed in a pointer.

I'm not sure what your teacher wants in the transform function -- "transform" is a pretty broad concept. You could switch rows and columns -- that would be a transform. To do this you could change line 20 to:

array2[row][column] = array1[column][row];
I just need the first array which would look like this 5x5 array1:
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

To be transformed to array2 which would look like this:

5 4 3 2 1
10 9 8 7 6
15 14 13 12 11
20 19 18 17 16
25 24 23 22 21
And i have no clue what to do on the function in order to transform array1 into array2 and return array2 to main function and then use the display function to display the array2 we get from transforming array1.
You have no clue? Look at those numbers. What does happen to them?

For example, the value 14. Where is it originally? Where is it after transformation? Will it stay on same row? Will it stay on same column?
Topic archived. No new replies allowed.