C++ help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ help

Who can help me to transpose a 2D dynamic matrix please? It's urgent

8th Jun 2022, 10:23 AM
Daniel Alexis
13 Answers
+ 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?
8th Jun 2022, 11:49 AM
Emerson Prado
Emerson Prado - avatar
+ 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.
8th Jun 2022, 10:52 AM
Emerson Prado
Emerson Prado - avatar
+ 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.
9th Jun 2022, 4:30 AM
Emerson Prado
Emerson Prado - avatar
0
In this Matrix I have to create 2 functions
8th Jun 2022, 10:25 AM
Daniel Alexis
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
8th Jun 2022, 10:54 AM
Daniel Alexis
0
I first need to create a table by entering the rows and columns then get the transpose
8th Jun 2022, 12:06 PM
Daniel Alexis
0
I tested it now, and it creates the table successfully. Do you have any issue with this part?
8th Jun 2022, 1:02 PM
Emerson Prado
Emerson Prado - avatar
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
8th Jun 2022, 1:32 PM
Daniel Alexis
0
OK. Do you need to create a new matrix with the transposed data, or just output it?
8th Jun 2022, 1:59 PM
Emerson Prado
Emerson Prado - avatar
0
I want to create a matrix and then display its transposed
8th Jun 2022, 2:07 PM
Daniel Alexis
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.
8th Jun 2022, 2:54 PM
Emerson Prado
Emerson Prado - avatar
0
I don't understand too much
8th Jun 2022, 2:59 PM
Daniel Alexis
0
I'm not too good at C++
8th Jun 2022, 3:00 PM
Daniel Alexis