| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1003 人关注过本帖
标题:[Error] ld returned 1 exit status
取消只看楼主 加入收藏
yd2457606614
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2018-8-3
结帖率:100%
收藏
 问题点数:0 回复次数:0 
[Error] ld returned 1 exit status
#include<iostream>
#include<Windows.h>
#include<conio.h>
#include<cstdio>
//控制台的输入输出; //mspaind在cmd中打开画图。
using namespace std;
int mmap[8][10]={(0,0,0,1,1,1,0,0,0,0),
                (0,0,0,1,3,1,0,0,0,0),
                (0,0,0,1,0,1,1,1,1,0),
                (0,1,1,1,4,0,4,3,1,0),
                (0,1,3,0,4,5,1,1,1,0),
                (0,1,1,1,1,4,1,0,0,0),
                (0,0,0,0,1,3,1,0,0,0),
                (0,0,0,0,1,1,1,0,0,0)};
void Draw_Map(){
    for (int i = 0; i < 8; i++){
        for(int j = 0; j < 10;j++){
            switch(mmap[i][j]){
            case 0:cout<<" ";break;
            case 1:cout<<"#";break;
            case 3:cout<<"*";break;
            case 4:cout<<"$";break;
            case 5:cout<<"a";break;}
        
        }
    }
};

void PlayGame(){
    int x,y;
    for(int i = 0;i < 8; i++){
        for(int j = 0; j < 10;j++){
            if(mmap[i][j] == 5){
                x = i;
                y = j;
            }
        }
    }
    char ch;
    ch =getch();
    switch(ch){
        case 'W':
        case 'w':if(mmap[x - 1][y] == 0){
                    mmap[x - 1][y] = 5;
                    mmap[x][y] = 0;
        }else if (mmap[x-1][y]==4){
            if (mmap[x -2][y] ==0||mmap[x - 2][y] == 3){
                mmap[x - 2][y] = 4;
                mmap[x -1][y] = 5;
                mmap[x][y]=0;
            }
        }
        break;
    case 'S':
    case 's':if(mmap[x + 1][y] == 0){
                    mmap[x + 1][y] = 5;
                    mmap[x][y] = 0;
        }else if (mmap[x+1][y]==4){
            if (mmap[x + 2][y] ==0||mmap[x + 2][y] == 3){
                mmap[x + 2][y] = 4;
                mmap[x + 1][y] = 5;
                mmap[x][y]=0;
            }
        }
        break;
        case 'A':
        case 'a':if(mmap[x][y-1] == 0){
                    mmap[x][y-1] = 5;
                    mmap[x][y] = 0;
        }else if (mmap[x][y-1]==4){
            if (mmap[x][y-2] ==0||mmap[x][y-2] == 3){
                mmap[x][y-2] = 4;
                mmap[x][y-1] = 5;
                mmap[x][y]=0;
            }
        }
        break;
    case 'D':
    case 'd':if(mmap[x][y+1] == 0){
                    mmap[x][y+1] = 5;
                    mmap[x][y] = 0;
        }else if (mmap[x][y+1]==4){
            if (mmap[x][y+2] ==0||mmap[x][y+2] == 3){
                mmap[x][y+2] = 4;
                mmap[x][y+1] = 5;
                mmap[x][y]=0;
            }
        }
        break;
    }
}
int main(){
   
    mciSendString("open ",0,0,0);//打开音频
    mciSendString("play",0,0,0);
    while (1){
        Draw_Map();
        PlayGame();
    }
    return 0;
}
[Error] ld returned 1 exit status
搜索更多相关主题的帖子: int for case cout break 
2018-08-03 22:21
快速回复:[Error] ld returned 1 exit status
数据加载中...
 
   



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

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