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
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;
}
0
I tried it didn't work
0
Where are you displaying array values? Replace these lines there...! it echoing values.
0
Didn’t work
0
Very urgent
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.
0
yeah i did but it didn't work
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....
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;
}
- 1
Thx. where should I put it? can you add it for me please?