为什么会和画圆函数起冲突运行出错呢??调用了api又装了easyX?是不兼容吗?
#include<windows.h>#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
#define up_x 5
#define up_y 5//上界
int main(void)
{
COORD *biankuang(void);//添加边框的函数
HANDLE hout;//定义句柄
COORD gotoxy,*p;//初始坐标
int i,j,end,down_x,down_y;//下界
char c,d;
hout=GetStdHandle(STD_OUTPUT_HANDLE);//句柄,标准输出
SetConsoleTextAttribute(hout,FOREGROUND_RED);//控制台字体颜色
p=biankuang();//调用边框
circle(2,2,1);//????
gotoxy.X=p->X-20;gotoxy.Y=p->Y-10;
i=p->X-20;j=p->Y-10;
down_x=p->X;down_y=p->Y;
SetConsoleCursorPosition(hout, gotoxy);//输出初始图案
printf("%c",2);
for(end=0;;end++)
{
c=getch();
switch(c)
{
case 'w':j=j-1;break;
case 'a':i=i-1;break;
case 's':j=j+1;break;
case 'd':i=i+1;break;//移动
default: end=0;
}
if( (i<down_x&&i>up_x) && (j<down_y&&j>up_y) )
{
system("cls");
biankuang();
gotoxy.X=i;gotoxy.Y=j;
SetConsoleCursorPosition(hout, gotoxy);
printf("%c",2);
}
else
{
if(i==down_x&&j==down_y)
{i--;j--;}
else
{if(i==down_x) i--;if(j==down_y) j--;}
if(i==up_x&&j==up_y)
{i++;j++;}
else
{if(i==up_x) i++;if(j==up_y) j++;}//让笑脸只能在框内运动
}
}
return 0;
}
COORD *biankuang(void)//边框函数
{
HANDLE Hout;
COORD *p;
COORD up={5,5};//上界点
COORD down={40,20};//下界点
int i=up.X,j=up.Y;
p = &down;
Hout=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(Hout,FOREGROUND_BLUE);//zitiyanse
for(;up.Y<=down.Y;up.Y++)
{
for(up.X=i;up.X<=down.X;up.X++)
{
if(up.Y==j||up.Y==down.Y)
{SetConsoleCursorPosition(Hout,up);printf("-");}
else
{
if(up.X==i||up.X==down.X)
{SetConsoleCursorPosition(Hout,up);printf("|");}
else putchar(' ');
}
}
putchar('\n');
}
return(p);
}