| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 426 人关注过本帖
标题:各位路过的请看看这个二维数组地图的问题!
取消只看楼主 加入收藏
yt22534827
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-8-17
收藏
 问题点数:0 回复次数:1 
各位路过的请看看这个二维数组地图的问题!
现在编了一个地图,如何用getch切入?小子刚学,请不要改前面的,谢谢了!大家指点下,不胜感激!
就是让里面那个黑色的球体能在里面动起来,用getch做,该怎么做呀?在不改上面程序的基础上!谢谢各位了!
0表示路,1表是间隔物!
#include <stdio.h>
int map[30][30] =
    {
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        {0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1},
        {1,0,0,0,1,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,1,1,0,1},
        {1,0,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,1},
        {1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,0,1,0,1},
        {1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0,1,0,1,0,1},
        {1,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,0,1},
        {1,0,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1},
        {1,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1},
        {1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1},
        {1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1},
        {1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1},
        {1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1},
        {1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1},
        {1,1,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1},
        {1,0,1,1,0,1,0,1,0,1,1,0,1,1,1,1,0,0,1,1,0,1,0,1,0,0,0,1,0,1},
        {1,0,1,1,0,1,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,0,1,1,1,1,1,0,1},
        {1,0,1,0,0,1,0,1,0,1,0,1,1,1,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,1},
        {1,0,1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,1},
        {1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,1,1,0,1,0,0,0,0,1},
        {1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,0,1},
        {1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,0,1},
        {1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,0,1},
        {1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,0,1},
        {1,0,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,1,1,0,1},
        {1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,1,1,1,1,1,0,1,0,1,1,0,1,1,0,1},
        {1,0,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,9},
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}

    };
void main (void)
{
    for (int nRow = 0; nRow < 30; nRow++)
    {
        for (int nLow = 0; nLow <30;nLow++)
        {
            switch (map[nRow][nLow])
            {
            case 0:
                printf("  ");
                break;
            case 1:
                printf("■");
                break;
            case 9:
                printf("●");
                break;
            }
        }
        printf("\n");
    }
}

[[it] 本帖最后由 yt22534827 于 2008-8-25 17:10 编辑 [/it]]
搜索更多相关主题的帖子: 二维问题 
2008-08-25 15:29
yt22534827
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-8-17
收藏
得分:0 
不好意思,刚才断网了!现在补充一点
就是让里面那个黑色的球体能在里面动起来,用getch做,该怎么做呀?在不改上面程序的基础上!谢谢各位了!
2008-08-25 16:12
快速回复:各位路过的请看看这个二维数组地图的问题!
数据加载中...
 
   



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

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