#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
int main() {
    int row;
    cout << "请输入行数:";
    cin >> row;

    for (int i = 1; i <= row; i++) {
        for (int k = 0; k < row - i; k++) {
            cout << " ";
        }
        for (int j = 0; j < 2*i - 1; j++) {
            cout << "*";
        }
        cout << endl;
    }
    system("pause");
    return 0;
}

 

posted on 2022-08-08 19:17  wshidaboss  阅读(503)  评论(0编辑  收藏  举报