问题:
解答:
#include <iostream>
using namespace std;
int main()
{
int count = 0;
cout << "请输入星星的行数:";
cin >> count;
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count - i - 1; j++)
{
cout << ".";
}
for (int k = 0; k <= i; k++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
运行结果:
考查点:
- 循环次数的动态控制
- 矩阵循环嵌套
2024年8月25日20:54:01
标签:count,cout,int,++,循环,Plus,动态控制,习题,Primer From: https://blog.csdn.net/qq_74047911/article/details/141534723