猿问

如何把以下nesed for loop改为nested do while loops?

(问题的return 0; } 不须理会,只是错误地输入了)
#include <iostream>
using namespace std;
int main()
{ int rows, columns, i, j;
char theChar;
cout << "No. of rows? ";
cin >> rows;
cout << "No. of columns? ";
cin >> columns;
cout << "Which characters? ";
cin >> theChar;
for (i=0; i<rows; i++)
{ for (j=0; j<columns; j++)
cout << theChar;
cout << "\n";
}
return 0;
}

一只甜甜圈
浏览 143回答 1
1回答

繁华开满天机

while(i <rows){ while(j < columns){j++;cout << theChar;cout << "\n";}i++;}是这样吧?还是说必须要do...while的形式
随时随地看视频慕课网APP
我要回答