0

Hello. Can anybody tell me how to print contest of array so that five components will be printed per line with nested loop?

https://code.sololearn.com/cF4Wm55KRBCG/?ref=app

26th Jan 2021, 7:47 PM
TeaserCode
6 odpowiedzi
+ 1
Nested loop right? int index=0; for(int i=0;i<3;i++){ for(int j=0;j<5;j++){ cout<<list[index]; index++; } cout<<endl; }
26th Jan 2021, 7:54 PM
Abhay
Abhay - avatar
0
maybe you want some separators: for (int i=0; i<3; ++i) { for (int j=0; j<5; ++j) { cout << list[i*5+j] << ", "; } cout << endl; }
26th Jan 2021, 8:49 PM
visph
visph - avatar
0
You convert one-dimensional array to two-dimensional.
27th Jan 2021, 8:28 AM
TeaserCode
0
we read 1d array as if it was 2d ^^
27th Jan 2021, 8:30 AM
visph
visph - avatar
0
Do we handle same as at making the patterns?
27th Jan 2021, 8:35 AM
TeaserCode
0
???
27th Jan 2021, 8:36 AM
visph
visph - avatar