C++ 尝试使用嵌套的for循环删除某些输出
正在尝试生成此输出:C++ 尝试使用嵌套的for循环删除某些输出,c++,for-loop,C++,For Loop,正在尝试生成此输出: #include <iostream> using namespace std; int main (){ int row, column = 0, colCount = 3, rowCount = 3; for (column; column < colCount; column++){ for(row = 0; row <= (rowCount - 1);
#include <iostream>
using namespace std;
int main (){
int row,
column = 0,
colCount = 3,
rowCount = 3;
for (column; column < colCount; column++){
for(row = 0; row <= (rowCount - 1); row++){
cout << column << " " << row;
if(row < (rowCount - 1)){
cout << ", ";
}
}
cout << column;
cout << endl;
}
}
0 0, 0 1, 0 20
1 0, 1 1, 1 21
2 0, 2 1, 2 22
除去
cout删除
cout
0 0, 0 1, 0 2
1 0, 1 1, 1 2
2 0, 2 1, 2 2
cout << column;
cout << endl;
#include <iostream>
using namespace std;
int main (){
int row,
column = 0,
colCount = 3,
rowCount = 3;
for (column; column < colCount; column++){
for(row = 0; row <= (rowCount - 1); row++){
cout << column << " " << row;
if(row < (rowCount - 1)){
cout << ", ";
}
}
cout << endl;
}
}