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

C++ help

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

6th Jun 2022, 9:32 AM
Daniel Alexis
10 Answers
0
for (i = 0; i < d1; i++) { for (j = 0; j < d2; j++) cout << m[ j ][ i ] << " "; // just interchange i, j cout << endl; }
6th Jun 2022, 9:46 AM
Jayakrishna 🇮🇳
0
I tried it didn't work
6th Jun 2022, 9:56 AM
Daniel Alexis
0
Where are you displaying array values? Replace these lines there...! it echoing values.
6th Jun 2022, 10:07 AM
Jayakrishna 🇮🇳
0
Didn’t work
6th Jun 2022, 10:09 AM
Daniel Alexis
0
Very urgent
6th Jun 2022, 10:15 AM
Daniel Alexis
0
Already told. You should have know what your program doing.. Use my statements instead of your print statements.. Just interchange j, i in output.
6th Jun 2022, 1:31 PM
Jayakrishna 🇮🇳
0
yeah i did but it didn't work
6th Jun 2022, 2:59 PM
Daniel Alexis
0
What I have to reply? 🤔I have to say only try again..! Post your tried update code here.. So that i can understand what is your mistake! But it seems you need to revise the topics again.. about loops and input/outputs....
6th Jun 2022, 6:36 PM
Jayakrishna 🇮🇳
0
In C, #include <stdio.h> int main() { int a[2][2],i,j; printf("Enter the numbers \n"); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d ",&a[i][j]); } } for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("%d ",a[j][i]); } printf("\n"); } return 0; }
8th Jun 2022, 3:04 AM
Ranit Ghosh
Ranit Ghosh - avatar
- 1
Thx. where should I put it? can you add it for me please?
6th Jun 2022, 9:52 AM
Daniel Alexis