Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
Hello. Can anybody tell me how to print contest of array so that five components will be printed per line with nested loop?
6 ответов
+ 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;
}
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;
}
0
You convert one-dimensional array to two-dimensional.
0
we read 1d array as if it was 2d ^^
0
Do we handle same as at making the patterns?
0
???