#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; }