| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 537 人关注过本帖
标题:[求助]C语言编程的一个课程设计比较复杂,需要帮下
只看楼主 加入收藏
songjave
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-17
收藏
 问题点数:0 回复次数:1 
[求助]C语言编程的一个课程设计比较复杂,需要帮下

有个课程设计的题目比较难啊 有高手帮我吗?用的是TC2.0
要先做个选择界面 选择难度 进入和退出,在进行游戏时按ESC可以回到选择界面
游戏界面要有个小人和个宝藏 小人可以上下左右移动 到达宝藏后自动返回带选择界面
我编了点游戏界面程序 帮我搞下啊
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#include "stdlib.h"
void main()
{
loop: int i,j,temp;
char k,m[10];
int x=22,y=23;
int a[24][25]=
{
1,0,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,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,
1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,
1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,
1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,
1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,
1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,
1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,
1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,
1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,
1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,
1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,
1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,
1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,
1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,
1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,
1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,
1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,
1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,
1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,
1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,
1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,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
} ;
temp=a[x][y];
a[x][y]=2;
for (i=0;i<24;i++)
{
for (j=0;j<25;j++)
printf("%c",a[i][j]);
printf("\n"); /*打印地图*/
}
k=getchar();

if(!k)
k=getchar();

do
{

a[x][y]=temp;
switch (k)
{
case 'a': if (a[x][y-1]==0) y=y-1;break;
case 'd': if (a[x][y+1]==0) y=y+1;break;
case 'w': if (a[x-1][y]==0 ) x=x-1;break;
case 's': if (a[x+1][y]==0 ) x=x+1;break;
default : break;
}


temp=a[x][y];
a[x][y]=2;
for (i=0;i<24;i++)
{
for (j=0;j<25;j++)
printf("%c",a[i][j]);
printf("\n");
} /*完成移动操作*/

if (a[0][1]==2)
{
printf("Well done!!!\n Do you want to try it again?(y/n)");
scanf("%s",m);
if(strcmp(m,"y")==0)
{
goto loop; /*重新开始*/
}
else
break;
}

k=getchar();
if(!k)
k=getchar();
system("cls");
}while (k!=0);

}

搜索更多相关主题的帖子: C语言 课程 include 界面 
2006-06-17 20:25
–★–
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1512
专家分:0
注 册:2006-5-1
收藏
得分:0 
平时怎么学的呢?
什么叫学到用时方恨少?
建议用google搜索一下
“搬运工”游戏的代码。

落霞与孤鹜齐飞,秋水共长天一色! 心有多大,路有多宽。三教九流,鸡鸣狗盗。兼收并蓄,海纳百川。
2006-06-18 05:20
快速回复:[求助]C语言编程的一个课程设计比较复杂,需要帮下
数据加载中...
 
   



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

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