小弟自己寫的賽馬遊戲
目前沒有贏過
自己看看運氣如何吧 ^^~~~
下載
註:用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 可以看到全部內容