【发布时间】:2021-12-19 23:54:38
【问题描述】:
这是我为使用 single 打印模式而编写的代码,但是它不起作用,你能帮帮我吗。
#include<iostream>
using namespace std;
int main()
{
int line, star = 0, n;
cin >> n;
for (line = 1; line <= n; line++)
{
if (star < n)
{
cout << "*";
star++;
continue;
}
if (star == line)
{
cout << endl;
star
}
}
system("pause");
return 0;
}
【问题讨论】:
-
打印一行 10 颗星:- std::cout