第九周项目三 e

来源:互联网 发布:ms sql 去空格 编辑:程序博客网 时间:2024/06/09 21:07
<span style="font-size:18px;"><span style="font-size:18px;">问题及代码:</span></span>
<span style="font-size:18px;"><span style="font-size:18px;">/*Copyright (c) 2014,烟台大学计算机学院 *ALL right reserved *文件名;frist.cpp *作者;童宇 *完成日期2014年10月10日 *版本号v1.0 *问题描述:输出星号图e*输入描述: *程序输出:输出星号图e*/  #include <iostream>using namespace std;int main(){    int a,b,c,d=4,e,f=1,g;    for (a=1; a<=5; a++)    {        cout <<" ";    }    cout << "*" << endl;    for (b=2; b<=5; b++)    {        for (c=1; c<=d; c++)        {            cout <<" ";        }        d--;        cout <<"*";        for (e=1; e<=f; e++)        {            cout <<" ";        }        f+=2;        cout <<"*"<<endl;    }    for (g=1; g<=11;g++)    {        cout <<"*";    }        return 0;}</span></span>

运行结果:


学习心得:

   面对较复杂的问题,我们应该冷静下来,抛开代码,利用好“自顶向下,逐步求精”方法,不要急于求成!!

0 0
原创粉丝点击