#include<iostream>
#include<Windows.h>
#include<string>
using namespace std;
//打印金字塔型星星
//1 3 5 7 9 11
//1 2 3 4 5 6 每行星星的个数2*n-1
int main()
{
int n;
cout << "请输入想打印星星的层数" << endl;
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int k = 0; k < n-i; k++) //打印空格
{
cout << " ";
}
for (int j = 0; j < 2*i-1; j++)//打印*每行星星的个数2*n-1
{
cout << "*";
}
cout << endl;
}
system("pause");
return 0;
}