输入行数,用C++打印金字塔型星号
作者:互联网
#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; }
标签:std,main,金字塔,cout,星号,C++,int,include,row 来源: https://www.cnblogs.com/smartlearn/p/16563141.html