求教C语言问题
#include<graphics.h>#include<bios.h>#defineVK_LEFT0x4b00#defineVK_RIGHT0x4d00#defineV...
#include <graphics.h>
#include <bios.h>
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4100
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1C0d
#define SCREENWIDTH 640
#define SCREENHEIGHT 480
#define SIZE 16
#define BGCOLOR BLACK
#define FORECLOR YELLOW
#define SCOREINTERVAL 30
void DrawBlock(int x,int y,int color)
{
setfillstyle(SOLID_FILL,color);
bar(SIZE*x,SIZE*y,SIZE*(x+1),SIZE*(y+1));
}
enum direct{Left,Up,Right,Down};
enum bool{False,True};
enum bool Moveable(int x,int y,enum direct dir)
{
switch(dir)
{
case Left:
if(x>0) return True;
break;
case Up:
if(y>0) return True;
break;
case Right:
if(x<SCREENWIDTH/SIZE-1)return True;
break;
case Down:
if(y<SCREENHEIGHT/SIZE-1)
return Ture;
}
return false;
void MoveBlock(int*x,int*y,enum direct dir)
{
Drawblock(*x,*y,BGCDLOR);
swith(dir)
{
case Left;
(*x)--;
break;
case Up;(*x)--;
break;
case Right;
(*x)++;
break;
case Down;
(*y)++;
break;
}
DrawBlock(*x,*y,FORECOLOR);
}
void main()
{
int x=0,y=0;
int key;
enun bool fGaneDver=False;
int graoph(&graphdriver,&graphmode,"H:\TCPP30E");
DrawBlock(x,y,FORECDLOR);
for(;;)
{
if(bioskey(1) key=bioskkkey(0));
else key=0;
swith(key)
{
case VK_LEFT:
if(Moveblock(x,y,Left))
MoverBlock(&x,&y,Left);
break;
case VK_RIGHT:
if(Moveblock(x,y,Right))
MoverBlock(&x,&y,Right);
break;
case VK_UP:
if(Moveblock(x,y,up))
MoverBlock(&x,&y,Up);
break;
case VK_DOWN:
if(Moveblock(x,y,Down))
MoverBlock(&x,&y,Down);
break;
case VK_ESC:
fGameover=Ture;
break;
}
if(fGameover)
break;
}
closegraph();
}
我不知道错误在那里,帮我看下,谢了 。 展开
#include <bios.h>
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4100
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1C0d
#define SCREENWIDTH 640
#define SCREENHEIGHT 480
#define SIZE 16
#define BGCOLOR BLACK
#define FORECLOR YELLOW
#define SCOREINTERVAL 30
void DrawBlock(int x,int y,int color)
{
setfillstyle(SOLID_FILL,color);
bar(SIZE*x,SIZE*y,SIZE*(x+1),SIZE*(y+1));
}
enum direct{Left,Up,Right,Down};
enum bool{False,True};
enum bool Moveable(int x,int y,enum direct dir)
{
switch(dir)
{
case Left:
if(x>0) return True;
break;
case Up:
if(y>0) return True;
break;
case Right:
if(x<SCREENWIDTH/SIZE-1)return True;
break;
case Down:
if(y<SCREENHEIGHT/SIZE-1)
return Ture;
}
return false;
void MoveBlock(int*x,int*y,enum direct dir)
{
Drawblock(*x,*y,BGCDLOR);
swith(dir)
{
case Left;
(*x)--;
break;
case Up;(*x)--;
break;
case Right;
(*x)++;
break;
case Down;
(*y)++;
break;
}
DrawBlock(*x,*y,FORECOLOR);
}
void main()
{
int x=0,y=0;
int key;
enun bool fGaneDver=False;
int graoph(&graphdriver,&graphmode,"H:\TCPP30E");
DrawBlock(x,y,FORECDLOR);
for(;;)
{
if(bioskey(1) key=bioskkkey(0));
else key=0;
swith(key)
{
case VK_LEFT:
if(Moveblock(x,y,Left))
MoverBlock(&x,&y,Left);
break;
case VK_RIGHT:
if(Moveblock(x,y,Right))
MoverBlock(&x,&y,Right);
break;
case VK_UP:
if(Moveblock(x,y,up))
MoverBlock(&x,&y,Up);
break;
case VK_DOWN:
if(Moveblock(x,y,Down))
MoverBlock(&x,&y,Down);
break;
case VK_ESC:
fGameover=Ture;
break;
}
if(fGameover)
break;
}
closegraph();
}
我不知道错误在那里,帮我看下,谢了 。 展开
2个回答
展开全部
这程序我都不好意思改,至少有五十个错误,从哪找来的啊???
#include <graphics.h>
#include <bios.h>
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4100
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1C0d
#define SCREENWIDTH 640
#define SCREENHEIGHT 480
#define SIZE 16
#define BGCOLOR BLACK
#define FORECOLOR YELLOW
#define SCOREINTERVAL 30
int DrawBlock(int x,int y,int color)
{
setfillstyle(SOLID_FILL,color);
bar(SIZE*x,SIZE*y,SIZE*(x+1),SIZE*(y+1));
}
enum direct{Left,Up,Right,Down};
enum bool{False,True};
enum bool Moveable(int x,int y,enum direct dir)
{
switch(dir)
{
case Left:
if(x>0) return True;
break;
case Up:
if(y>0) return True;
break;
case Right:
if(x<SCREENWIDTH/SIZE-1) return True;
break;
case Down:
if(y<SCREENHEIGHT/SIZE-1) return True;
}
return False;
}
int MoveBlock(int*x,int*y,enum direct dir)
{
DrawBlock(*x,*y,BGCOLOR);
switch(dir)
{
case Left:
(*x)--;
break;
case Up:
(*x)--;
break;
case Right:
(*x)++;
break;
case Down:
(*y)++;
break;
}
DrawBlock(*x,*y,FORECOLOR);
}
void main()
{
int x=0,y=0;
int key;int fGameover;
enum bool fGaneDver=False;
int graphdriver=DETECT,graphmode;
initgraph(&graphdriver,&graphmode,"H:\TCPP30E");
DrawBlock(x,y,FORECOLOR);
for(;;)
{
if(bioskey(1))
key=bioskey(0);
else
key=0;
switch(key)
{
case VK_LEFT:
MoveBlock(&x,&y,Left);
break;
case VK_RIGHT:
MoveBlock(&x,&y,Right);
break;
case VK_UP:
MoveBlock(&x,&y,Up);
break;
case VK_DOWN:
MoveBlock(&x,&y,Down);
break;
case VK_ESC:
fGameover=True;
break;
}
if(fGameover)
break;
}
closegraph();
}
我已经改到在TC中只有一个错误的情况,好像说什么图形什么的没有初始化。这个我不会,因为没学过,呵呵。就这样啦
#include <graphics.h>
#include <bios.h>
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4100
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1C0d
#define SCREENWIDTH 640
#define SCREENHEIGHT 480
#define SIZE 16
#define BGCOLOR BLACK
#define FORECOLOR YELLOW
#define SCOREINTERVAL 30
int DrawBlock(int x,int y,int color)
{
setfillstyle(SOLID_FILL,color);
bar(SIZE*x,SIZE*y,SIZE*(x+1),SIZE*(y+1));
}
enum direct{Left,Up,Right,Down};
enum bool{False,True};
enum bool Moveable(int x,int y,enum direct dir)
{
switch(dir)
{
case Left:
if(x>0) return True;
break;
case Up:
if(y>0) return True;
break;
case Right:
if(x<SCREENWIDTH/SIZE-1) return True;
break;
case Down:
if(y<SCREENHEIGHT/SIZE-1) return True;
}
return False;
}
int MoveBlock(int*x,int*y,enum direct dir)
{
DrawBlock(*x,*y,BGCOLOR);
switch(dir)
{
case Left:
(*x)--;
break;
case Up:
(*x)--;
break;
case Right:
(*x)++;
break;
case Down:
(*y)++;
break;
}
DrawBlock(*x,*y,FORECOLOR);
}
void main()
{
int x=0,y=0;
int key;int fGameover;
enum bool fGaneDver=False;
int graphdriver=DETECT,graphmode;
initgraph(&graphdriver,&graphmode,"H:\TCPP30E");
DrawBlock(x,y,FORECOLOR);
for(;;)
{
if(bioskey(1))
key=bioskey(0);
else
key=0;
switch(key)
{
case VK_LEFT:
MoveBlock(&x,&y,Left);
break;
case VK_RIGHT:
MoveBlock(&x,&y,Right);
break;
case VK_UP:
MoveBlock(&x,&y,Up);
break;
case VK_DOWN:
MoveBlock(&x,&y,Down);
break;
case VK_ESC:
fGameover=True;
break;
}
if(fGameover)
break;
}
closegraph();
}
我已经改到在TC中只有一个错误的情况,好像说什么图形什么的没有初始化。这个我不会,因为没学过,呵呵。就这样啦
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询