|
@ -2451,6 +2451,51 @@ void b_crossword(){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Gambling Game |
|
|
|
|
|
|
|
|
|
|
|
void b_gamble() |
|
|
|
|
|
{ |
|
|
|
|
|
int wallet = 100; |
|
|
|
|
|
int bet; |
|
|
|
|
|
int guess; |
|
|
|
|
|
int number; |
|
|
|
|
|
|
|
|
|
|
|
srand(time(NULL)); |
|
|
|
|
|
|
|
|
|
|
|
while (wallet > 0) { |
|
|
|
|
|
printf("You have $%d. Enter your bet: ", wallet); |
|
|
|
|
|
scanf("%d", &bet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bet > wallet) { |
|
|
|
|
|
printf("You don't have enough money. Try a smaller bet.\n"); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if (bet <= 0) { |
|
|
|
|
|
printf("Invalid bet. Try again.\n"); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("Guess a number between 1 and 10: "); |
|
|
|
|
|
scanf("%d", &guess); |
|
|
|
|
|
|
|
|
|
|
|
number = rand() % 10 + 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (guess == number) { |
|
|
|
|
|
printf("You win! The number was %d.\n", number); |
|
|
|
|
|
wallet += bet; |
|
|
|
|
|
} else { |
|
|
|
|
|
printf("You lose. The number was %d.\n", number); |
|
|
|
|
|
wallet -= bet; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("You are out of money. Better luck next time!\n"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void v_play_rockpapersciss(){ |
|
|
void v_play_rockpapersciss(){ |
|
|
int player_choice, computer_choice, player_score = 0, computer_score = 0; |
|
|
int player_choice, computer_choice, player_score = 0, computer_score = 0; |
|
|
srand(time(NULL)); |
|
|
srand(time(NULL)); |
|
@ -2928,7 +2973,8 @@ int main(int argc, char *argv[]) { |
|
|
printf("15. Germany Quiz!\n"); |
|
|
printf("15. Germany Quiz!\n"); |
|
|
printf("16. Breaking Bad Quiz!\n"); |
|
|
printf("16. Breaking Bad Quiz!\n"); |
|
|
printf("17. Mini-Game: Crossword Puzzle!\n"); |
|
|
printf("17. Mini-Game: Crossword Puzzle!\n"); |
|
|
printf("18. Exit\n"); |
|
|
|
|
|
|
|
|
printf("18. Gambling Game!\n"); |
|
|
|
|
|
printf("19. Exit\n"); |
|
|
printf("Enter your choice: "); |
|
|
printf("Enter your choice: "); |
|
|
scanf("%d", &choice); |
|
|
scanf("%d", &choice); |
|
|
v_progress_bar(argc,argv); |
|
|
v_progress_bar(argc,argv); |
|
@ -3003,6 +3049,10 @@ int main(int argc, char *argv[]) { |
|
|
jump_to_menu = 1; |
|
|
jump_to_menu = 1; |
|
|
break; |
|
|
break; |
|
|
case 18: |
|
|
case 18: |
|
|
|
|
|
b_gamble(); |
|
|
|
|
|
jump_to_menu = 1; |
|
|
|
|
|
break; |
|
|
|
|
|
case 19: |
|
|
printf("\nThank you for trying our C code!\n"); |
|
|
printf("\nThank you for trying our C code!\n"); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|