Skip to content

Instantly share code, notes, and snippets.

@koetoo
Created December 8, 2018 05:20
Show Gist options
  • Save koetoo/edf08970da9c1f28302ecc04a806b760 to your computer and use it in GitHub Desktop.
Save koetoo/edf08970da9c1f28302ecc04a806b760 to your computer and use it in GitHub Desktop.
//LOTERY Game Finish|6:12:2018/11:14AM I am train
#include <stdio.h>
#include <conio.h>
#include<stdlib.h>
int x;int age;char ch;int ran;
int money;
void getdata();
void lotery(int x,int money,int ran,int age);////
int main(){
getdata();
lotery(x,money,ran,age);
return 0;
}////
void getdata(){
printf("Enter your AGE\nbut you must 18++\n");
scanf("%d",&age);
if(age<18){
printf("You are not 18++\n");
exit(0);}
printf("enter your ID \nID is 111\n");
scanf("%d",&x);!
printf("Enter your money\nless 1000\n");
scanf("%d",&money);
if(money<999) {printf("Enter 1000 more\ntry again!!");
exit(0);
}
}
////
void lotery(int x,int money,int ran,int age){
while(age>18){
if(x==111)
{
int y;
printf("your total money is %d\n",money);
if(money==0){
printf("your loser now!\nhaha!good luck!\nnext time\n");
exit(0);}
printf("enter your LOTTERY number\nchoice is ( 1 to 5)\n");
scanf("%d",&y);
if(y==(ran=1+rand()%5))
{
int close;
printf(":...YOU WIN....:\n");
y=20*8;
printf("you get money is %d\n",y);
money+=y;
printf("Enter continue is 1 and exit is 2\n");
scanf("%d",&close);
if(close==1) printf("you can play again\n");
else exit(0);
}else
{
int close;
printf(":....YOU LOSE....:\n");
money-=20;
printf("try a gain you unlucky day\n");
printf("Enter continue is 1 and exit is 2\n");
scanf("%d",&close);
if(close==1) printf("you can play again\n");
else exit(0);
}
printf("your total money is %d\n",money);
}
}
}/////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment