一些扩展
查看原帖
一些扩展
645451
封禁用户楼主2022/6/5 17:47

[url=https://imgtu.com/i/XwPPOS][img]https://s1.ax1x.com/2022/06/05/XwPPOS.jpg[/img][/url]

#include <iostream>

using namespace std;

int main()
{
    int n=101;
    char ch='*';
    for (int i=1;i<=(n-1);i+=2)
    {
        for(int ich=0;ich<(n-i)/2;ich++)
        {
            cout << ' ';
        }
        for(int ich=0;ich<i;ich++)
        {
            cout << ch;
        }
        cout << endl;
    }
    for (int i=0;i<n;i++)
    {
        cout << ch;
    }
    cout << endl;
    for (int i=n-2;i>=0;i-=2)
    {
        for(int ich=0;ich<(n-i)/2;ich++)
        {
            cout << ' ';
        }
        for(int ich=0;ich<i;ich++)
        {
            cout << ch;
        }
        cout << endl;
    }
}

2022/6/5 17:47
加载中...