0
C++ help
Who can help me to transpose a 2D dynamic matrix please? It's urgent
13 Antworten
+ 3
First, always prefer the link to Code Playground inside the question description, not in answers. Scattered information becomes trouble if you get lots of answers.
That said, all you have to do is to reverse the loops and array dimensions. Do you need to create a new array or just output the original one transposed?
+ 1
If it's urgent, why not do it the right way, so you get closer to the solution?
Edit your question and include a link to your code in Code Playground, and a description of your difficulties.
This way, we know what to help you on.
+ 1
Daniel Alexis It doesn't demand too much. It's the same as the regular output, with rows and columns reversed:
You created an outer loop which iterates on rows. Then, you nested an inner loop which iterates on columns. Finally, you output array elements on these coordinates.
Transposing is all about reversing columns and rows. Rows become vertical, and columns, horizontal. So, print columns as if they were rows, and the other way round.
Do the outer loop for the columns and the inner one for the rows. Remember to move the loop limits too.
0
In this Matrix I have to create 2 functions
0
https://code.sololearn.com/cnSN18SCe74x/?ref=app
I have this code but I would like to put my rows and columns. rows become columns and columns become rows. Who can help me? it's urgent
0
I first need to create a table by entering the rows and columns then get the transpose
0
I tested it now, and it creates the table successfully. Do you have any issue with this part?
0
I don't have a problem with this part my problem is that I also want to transpose my table, i.e. rows become columns and columns become rows
0
OK. Do you need to create a new matrix with the transposed data, or just output it?
0
I want to create a matrix and then display its transposed
0
Just repeat the output section in lines 15 to 19, but reversing the loops - make the inner loop outer and the outer one inner.
0
I don't understand too much
0
I'm not too good at C++