小弟自己写的赛马游戏
目前没有赢过
自己看看运气如何吧 ^^~~~
下载
注:用TurboC 3.0 IDE 编译
若用其他编译器请将函式往上提
程式码:
//------------------ Start ------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
//-------------------------------------------------------------
int h={0,0,0,0,0,0,0,0,0}; // the point of the horse
int flag=0; /* stop when horse arrive
flag=0 -> continue, flag=1 -> stop */
int chk; // the number of the horse which is win
int way={1,1,1,1,1,1,1,1,1};
/* the way horses go
way=1 -> right, way=-1 -> left */
int num; // save the random number
int money=3000; // the money
int pay; // the money that paid
int bet; // horse number you bet
char again='y' // run program again
//-------------------------------------------------------------
void main()
{
double w;
randomize();
do
{
float k;
int g;
for( g=0;g<9;g++ )
{
h=0;
way=1;
}
chk=0;
flag=0;
pline();
betfont();
while( flag==0 )
{
horse();
}
gotoxy(35,19);
printf("The winner is No.%d\n\n",chk);
betpro();
gotoxy(30,24);
if( again=='n' )
break;
printf("Play again?(y/n) ");
again=getchar();
}while( (again=getchar()) !='n' );
cr();
}
//-------------------------------------------------------------
int pline()
{
// There is "80" lines in DOS
int i, line;
clrscr();
for(line=1;line<19;line=line+2)
{
gotoxy(1,lin ..
访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容