码迷,mamicode.com
首页 > 其他好文 > 详细

21.输出图形

时间:2014-08-06 14:07:51      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:style   color   os   io   for   div   line   ios   

        *
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*


#include<iostream>
using namespace std;

int main()
{
    for(int i=0;i<5;i++)
    {
        for(int j=1;j<=4-i;j++)
        {
            cout<<" ";
        }
        for(int k=1;k<=2*i+1;k++)
        {
            cout<<"*";
        }
        cout<<endl;
    }
    for(int m=3;m>=0;m--)
    {
        for(int n=1;n<=4-m;n++)
        {
            cout<<" ";
        }
        for(int p=1;p<=2*m+1;p++)
        {
            cout<<"*";
        }
        cout<<endl;
    }
    return 0;
}

 

21.输出图形,布布扣,bubuko.com

21.输出图形

标签:style   color   os   io   for   div   line   ios   

原文地址:http://www.cnblogs.com/jixiaowu/p/3894197.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!