| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1575 人关注过本帖
标题:打印
取消只看楼主 加入收藏
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
结帖率:91.67%
收藏
已结贴  问题点数:20 回复次数:2 
打印

怎么改成      *
           *  *  *
        *  *  *  *  *
     *  *  *  *  *  *  *
        *  *  *  *  *
           *  *  *
              *
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int i,j;
    for (i = 1; i <= 14; i += 1)
    {
        if (i % 2 != 0)
        {
            if (i <= 7)
            {
                for (j = 1; j <= i; j += 1)
                {
                    printf("*");
                }
            }
            else if (i > 7 && i <= 14)
            {
                for (j = 14; j>i; j--)
                    printf("*");
            }
            printf("\n");
        }
    }
    system("pause");                                                                                                                                                                                                                                                                  
    return 0;
}
搜索更多相关主题的帖子: 打印 include int for printf 
2018-11-25 15:56
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
收藏
得分:0 
回复 2楼 zbjzbj
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int i,j,k;
    for (i = 1; i <= 3; i ++)
    {
        for (j = 4; j > i; j--)
        {
            printf(" ");
        }
        for (k = 1; k <= i * 2 - 1; k ++)
        {
            printf("*");
        }
        printf("\n");
    }
    for (i = 1; i <=4; i++)
    {
        for (j = 1; j < i; j++)
        {
            printf(" ");
        }
        for (k = 1; k <= 9 - 2 * i; k++)
        {
            printf("*");
        }
        printf("\n");
    }
    system("pause");                                                                                                                                                                                                                                                                  
    return 0;
}
改对齐了,每个星号之间的空格不会
2018-11-25 16:17
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
收藏
得分:0 
回复 4楼 zbjzbj
星号后加空格,然后空格加空格就行了
2018-11-26 11:43
快速回复:打印
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023703 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved