当前位置: 代码迷 >> C语言 >> 求救 用C编写一个程序
  详细解决方案

求救 用C编写一个程序

热度:318   发布时间:2005-02-23 13:10:00.0
以下是引用神vLinux飘飘在2005-2-23 11:47:34的发言: 对了,计数器需要有数字跳动吗? 最后,你必须向我保证,以及向大家声明:你不是个女孩! 这个是我目前的服务标准~~有点奇怪是吧~~有因必有果。
什么时候成同志了?
----------------解决方案--------------------------------------------------------

#include <stdio.h> #include <graphics.h>

#define UP 18432 #define DOWN 20480 #define ENTER 7181

int barcolor[4]={WHITE,BLUE,BLUE,BLUE}; char bartext[4][6]={"HEART","COUNT","UFO","EXIT"}; int barstate=0;

void show_heart(); void show_count(); void show_ufo();

void in_graphics(); void out_graphics(); void press_control(); void show_menu_bar(); void clear_screen();

void main(){ in_graphics(); clear_screen(); show_menu_bar(); press_control(); out_graphics(); }

void in_graphics(){ int gd=DETECT,gm; initgraph(&gd,&gm,""); cleardevice(); }

void out_graphics(){ closegraph(); }

void clear_screen(){ setfillstyle(1,BLUE); bar(100-20,200-20,500+20,400+20); setfillstyle(1,7); bar(100-6,200-6,500-6,400-6); setcolor(WHITE); rectangle(100-1,200-1,500+1,400+1); setfillstyle(1,0); bar(100,200,500,400); }

void show_heart(){ int i; char heart[9][26]={ " * * * * ", " * * * * ", " * * * * ", " * * * ", " * * ", " * * ", " * * ", " * * ", " * * "}; clear_screen(); for(i=0;i<9;i++) outtextxy(200,210+i*20,heart[i]); } void show_count(){ char str[7]; int i; clear_screen(); setfillstyle(1,7); bar(200-4,250-4,400-4,300-4); setfillstyle(1,WHITE); bar(200,250,400,300); for(i=1500;i>=0;i--){ bar(220+65,260,260+65,268); itoa(i,str,10); setcolor(RED); outtextxy(220+65,260,str); setcolor(i/100); outtextxy(220+50,280,"quickly!"); } setfillstyle(1,WHITE); bar(220,280,350,300); setcolor(RED); outtextxy(220,280,"YOU DEATH! GAME OVER!"); } void show_ufo(){ clear_screen(); /*这里,你自己画个UFO吧,我不可能什么都帮你做完*/ /*你只能在(100,200)-(500,400)的区域范围内画,否则会超出边框*/ }

void show_menu_bar(){ int i; setcolor(0); for(i=0;i<4;i++){ setfillstyle(1,barcolor[i]); bar(10,i*20,100,20+i*20); outtextxy(10+10,i*20+8,bartext[i]); } }

void press_control(){ int key,i;

while(1){ key=bioskey(0); if(key==UP){ if(barstate==0) barstate=3; else barstate--; } else if(key==DOWN){ if(barstate==3) barstate=0; else barstate++; } else if(key==ENTER){ switch(barstate){ case 0: show_heart();break; case 1: show_count();break; case 2: show_ufo();break; case 3: exit(0); } continue; } else continue; for(i=0;i<4;i++) barcolor[i]=BLUE; barcolor[barstate]=WHITE; show_menu_bar(); } } 死KNOCKER还不是你害的,我必须要向我朋友保证以后不许帮女孩子回答问题。


----------------解决方案--------------------------------------------------------
呵呵,神加油啊
----------------解决方案--------------------------------------------------------
计数器不要求数字跳动的啊!! 我这正在等着呢? 那位写好了! 弄上来啊!
神vLinux飘飘
呵呵~~~~~~~!
----------------解决方案--------------------------------------------------------
晕,有数字跳动不好看吗?我觉得不错呀!

我的已经贴在上面了,UFO部分的你自己画!

还有什么不满意就+我Q76367959
放心,任务完成后我会删除的,不占你宝贵的空间.

[此贴子已经被作者于2005-3-6 15:14:34编辑过]



----------------解决方案--------------------------------------------------------
听说用windows编程黑容易实现
----------------解决方案--------------------------------------------------------
这个'黑'字用得好!
----------------解决方案--------------------------------------------------------
说实话,神,你这不是在帮人,而是在害人。
----------------解决方案--------------------------------------------------------
love fade out by promise died.../诺言消逝,爱已渐行渐远...
----------------解决方案--------------------------------------------------------
其实我比你还菜,我也不会,帮不了你了。
----------------解决方案--------------------------------------------------------
  相关解决方案