| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 690 人关注过本帖
标题:二维数组定义地图哪里有错求大神指出
只看楼主 加入收藏
dc1257305369
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-6-7
结帖率:100%
收藏
已结贴  问题点数:5 回复次数:2 
二维数组定义地图哪里有错求大神指出
int main()
{
    int map[15][13] = {0,0,0,3,2,1,2,3,2,1,0,0,0
                     0,10,10,2,0,0,0,0,0,2,0,0,0
                     0,10,10,1,0,0,0,0,0,3,0,0,0
                       0,7,0,2,0,0,0,0,0,2,0,0,0
                       2,1,2,9,0,0,0,0,0,4,2,3,2
                       3,0,0,0,0,0,0,0,0,0,0,0,1
                       2,0,0,0,0,0,0,0,0,0,0,0,2
                       8,1,1,1,1,1,5,5,1,1,1,1,6
                       2,0,0,0,0,0,0,0,0,0,0,0,2
                       3,0,0,0,0,0,0,0,0,0,0,0,1
                       2,1,2,9,0,0,0,0,0,4,2,3,2
                       0,0,0,2,0,0,0,0,0,2,0,7,0
                       0,0,0,1,0,0,0,0,0,3,11,11,0
                       0,0,0,2,0,0,0,0,0,2,11,11,0
                       0,0,0,3,2,1,2,3,2,1,0,0,0
                      };
    int i,j;
    for(i=0; i<15; i++)
    {
        for(j=0; j<13; j++)
        {
            if(map[i][j]==0)
                printf("■");
            else if(map[i][j]==1)
                printf("◆");
            else if(map[i][j]==3)
                printf("◇");
            else if(map[i][j]==2)
                printf("♠");
            else if(map[i][j]==4)
                printf("★");
            else if(map[i][j]==5)
                printf("☀");
            else if(map[i][j]==6)
                printf("←");
            else if(map[i][j]==8)
                printf("→");
            else if(map[i][j]==9)
                printf("☆");
            else if(map[i][j]==7)
                printf("☯");
            else if(map[i][j]==10)
                printf("☺");
            else if(map[i][j]==11)
                printf("☻");
            else if(j==12)
                printf("\n");
        }
    }
    //show();
    return 0;
}
2016-06-07 13:59
grmmylbs
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:54
帖 子:1409
专家分:5845
注 册:2016-2-14
收藏
得分:5 
    int map[15][13] = { 0,0,0,3,2,1,2,3,2,1,0,0,0,
        0,10,10,2,0,0,0,0,0,2,0,0,0,
        0,10,10,1,0,0,0,0,0,3,0,0,0,
        0,7,0,2,0,0,0,0,0,2,0,0,0,
        2,1,2,9,0,0,0,0,0,4,2,3,2,
        3,0,0,0,0,0,0,0,0,0,0,0,1,
        2,0,0,0,0,0,0,0,0,0,0,0,2,
        8,1,1,1,1,1,5,5,1,1,1,1,6,
        2,0,0,0,0,0,0,0,0,0,0,0,2,
        3,0,0,0,0,0,0,0,0,0,0,0,1,
        2,1,2,9,0,0,0,0,0,4,2,3,2,
        0,0,0,2,0,0,0,0,0,2,0,7,0,
        0,0,0,1,0,0,0,0,0,3,11,11,0,
        0,0,0,2,0,0,0,0,0,2,11,11,0,
        0,0,0,3,2,1,2,3,2,1,0,0,0
    };
每行后面少了逗号
2016-06-07 14:23
dc1257305369
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-6-7
收藏
得分:0 
回复 2楼 grmmylbs
谢谢
2016-06-07 14:28
快速回复:二维数组定义地图哪里有错求大神指出
数据加载中...
 
   



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

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