c++正三角形

#include “stdafx.h”
#include
using namespace std;
int main()
{
int n = 0;
for (int x = 5; x > 0; x–) {
for (int i = 0; i <= x; i++)
{
cout << " ";
}
for (int y = 0; y < 2 * n + 1; y++)
{
cout << “*”;
}
cout << endl;
n += 1;
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43210805/article/details/82794114
今日推荐