标签:name ios div cout clu include none closed 循环嵌套
1:代码如下:
// 3.22.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int i, j, k; for (i = 1; i <= 5; i++) //控制行数 { for (j = 1; j <= 5-i; j++) //控制空格数 cout << " "; for (k = 1; k <= 2 *i - 1; k++) //控制打印*号的数量 cout << "*"; cout << endl; } }
运行结果:
标签:name ios div cout clu include none closed 循环嵌套
原文地址:http://www.cnblogs.com/lovemi93/p/7518824.html