问题及代码:
/*
*Copyright(c)2014,烟台大学计算机学院
*All right reserved,
*文件名:test.cpp
*作者:chenqin14.
*完成日期:2014年10月27日
*版本号:v1.0
*
问题描述:
*输入描述:
*程序输出:星号图
*/
#include <iostream>
using namespace std;
int main()
{
int i,j,h;
for (i=1; i<=6; i++)
{
for (j=1; j<=6-i; j++)
{
cout <<" ";
}
for (h=1; h<=i; h++)
{
cout <<"*";
}
cout <<endl;
}
return 0;
}
运行结果:
知识点总结:学会了for语句的嵌套
学习心得:只要能编出一个程序,不害怕花多长时间。