下面的程序将重复宽度,但我也想重复输入高度。
int main ()
{
int height;
int width;
int count;
int hcount;
string character;
cout << "input width" << endl;
cin >> width;
cout << "input height" << endl;
cin >> height;
cout << "input character" << endl;
cin >> character;
for (hcount = 0; hcount < height; hcount++);
{
for (count = 0 ; count < width; count++)
cout << character;
cout << endl;
}
我需要添加另一个 for 循环吗?我不知道如何让它重复。我尝试添加另一个 for 循环,但更改了高度和宽度的顺序:
for (count = count < width; count++)
{ (count = count < height; hcount++)
cout < character;
cout << endl;
但没有运气。