第一范文网 - 专业文章范例文档资料分享平台

C语言课程设计实验报告-

来源:用户分享 时间:2025/11/15 2:34:00 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

void draw_circle(int x,int y,int color) { setcolor(color); setlinestyle(SOLID_LINE,0,1); x=(x+JZ)*BILI; y=(y+JS)*BILI; circle(x,y,8); }

void draw_slice(int x,int y,int color) { x=(x+JZ)*BILI; y=(y+JS)*BILI; setcolor(color) ; setfillstyle(SOLID_FILL,color); circle(x,y,8); floodfill(x,y,color); setcolor(color); setfillstyle(SOLID_FILL,color); pieslice(x,y,0,360,8); setcolor(color); }

void judgekey() { int i; int j; switch(key) { case LEFT : if(step_x-1<0) break; else { for(i=step_x-1,j=step_y;i>=1;i--) if(box[i][j]==0) { draw_circle(step_x,step_y,LIGHTBLUE); break; } if (i<1) break; step_x=i; judgewho(step_x,step_y); break;

9

}

case RIGHT: if(step_x+1>18) break; else { for(i=step_x+1,j=step_y;i<=18;i++) if(box[i][j]==0) { draw_circle(step_x,step_y,LIGHTBLUE); break; } if(i>18) break; step_x=i; judgewho(step_x,step_y); break; }

case DOWN : if((step_y+1)>18) break; else { for(i=step_x,j=step_y+1;j<=18;j++) if(box[i][j]==0) { draw_circle(step_x,step_y,LIGHTBLUE); break; } if(j>18)break; step_y=j; judgewho(step_x,step_y); break; } case UP : if((step_y-1)<0) break; else { for(i=step_x,j=step_y-1;j>=1;j--) if(box[i][j]==0) { draw_circle(step_x,step_y,LIGHTBLUE); break; }

10

if(j<1)break; step_y=j; judgewho(step_x,step_y); break; } case ESC : break; case SPACE : if(step_x>=1 && step_x<=18 && step_y>=1 && step_y<=18) { if(box[step_x][step_y]==0) { box[step_x][step_y]=flag; if (flag == 1) { draw_slice(step_x, step_y, BLUE); } else { draw_slice(step_x, step_y, WHITE); }

if (judgeresult(step_x,step_y)==1) { sound(1000); delay(1000); nosound(); gotoxy(30,4); if(flag==1) { setbkcolor(BLUE); cleardevice(); setviewport(100,100,540,380,1); setfillstyle(1,2); setcolor(YELLOW); rectangle(0,0,439,279); floodfill(50,50,14); setcolor(12); settextstyle(1,0,5); outtextxy(20,20,\ setcolor(14); settextstyle(3,0,5); outtextxy(120,120,\

setcolor(14);

11

}

settextstyle(2,0,8); getch();

closegraph(); exit(0);

if(flag==2) { setbkcolor(BLUE); } } else break; } }

void change() { if(flag==1) flag=2; else flag=1; }

cleardevice(); setviewport(100,100,540,380,1); setfillstyle(1,2); setcolor(YELLOW); rectangle(0,0,439,279); floodfill(50,50,14); setcolor(12); settextstyle(1,0,8); outtextxy(20,20,\ setcolor(14); settextstyle(3,0,5); outtextxy(120,120,\ setcolor(14); settextstyle(2,0,8); getch(); closegraph(); exit(0); } }

change(); break;

12

搜索更多关于: C语言课程设计实验报告- 的文档
C语言课程设计实验报告-.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c5w8qz5rwa17e16g2f5026bod04q32p00oy8_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top