1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
main()
{
clrscr();
int ratnum, cd=5, x=120, y, rat10=0, rat11=0, rat12=0, rat13=0, rat14=0, rat15=0, win;
do
{
gotoxy(30,10);
printf("Enter rat number from 1 to 15: ");
scanf("%d", &ratnum);
}
while(ratnum<=9||ratnum>=16);
clrscr();
gotoxy(25,10);
printf("The game will start in...");
delay(2000);
clrscr();
do
{
gotoxy(40,10);
printf("%d...", cd--);
delay(1000);
clrscr();
}
while(cd>0);
//race
while(x>200)
{
y=rand()%(15-10+1)+10;
switch(y)
{
case 10:
{
rat10=rat10++;
gotoxy(rat10, 1);
printf("10>");break;
}
case 11:
{
rat11=rat11++;
gotoxy(rat11, 2);
printf("11>");break;
}
case 12:
{
rat12=rat12++;
gotoxy(rat12, 3);
printf("12>");break;
}
case 13:
{
rat13=rat13++;
gotoxy(rat13, 4);
printf("13>");break;
}
case 14:
{
rat14=rat14++;
gotoxy(rat14, 5);
printf("14>");break;
}
case 15:
{
rat15=rat15++;
gotoxy(rat15, 6);
printf("15>");break;
}
}
delay(500);
--x;
}
delay(1000);
clrscr();
getch();
return 0;
}
|