C++-based triangle collection
发布时间
阅读量:
阅读量
C++输出各种样式的三角形
示例一(直角三角形符号)
#include <iostream>
using namespace std;
int main()
{
int rows;
cout << "输入行数: ";
cin >> rows;
for(int i = 1; i <= rows; ++i)
{
for(int j = 1; j <= i; ++j)
{
cout << "* ";
}
cout << "\n";
}
return 0;
}
输出结果
* * * * * * * * * * * * * * *
全部评论 (0)
还没有任何评论哟~
