#include<iostream>
using namespace std;
void main()
{
int row;
cout << "input rows(odd):" << endl;
cin >> row;
int i, j, n;
n = row / 2 + 1;
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n - i; j++)
cout << ' ';
for (j = 1; j <= 2 * i - 1; j++)
cout << '*';
for (j = 1; j <= n - i; j++)
cout << ' ';
cout << endl;
}
for (i = 1; i <= n - 1; i++)
{
for (j = 1; j <=i; j++)
cout << ' ';
for (j = 1; j <= row - 2 * i; j++)
cout << '*';
for (j = 1; j <= i; j++)
cout << ' ';
cout << endl;
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载