#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; }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279620.html