|
@ -507,19 +507,32 @@ void play_milliongame() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void v_guessingGame(void){ |
|
|
void v_guessingGame(void){ |
|
|
|
|
|
|
|
|
printf("Guess the Number!\n"); |
|
|
|
|
|
|
|
|
int secret_number, guess; |
|
|
|
|
|
srand(time(NULL)); |
|
|
|
|
|
secret_number = rand() % 100 + 1; |
|
|
|
|
|
printf("Guess the Number!\n\n"); |
|
|
printf("I am thinking of a number between 1 and 100. Can you guess what it is?\n"); |
|
|
printf("I am thinking of a number between 1 and 100. Can you guess what it is?\n"); |
|
|
|
|
|
|
|
|
|
|
|
while (1) { |
|
|
|
|
|
printf("Enter your guess: "); |
|
|
|
|
|
scanf("%d", &guess); |
|
|
|
|
|
if (guess > secret_number) { |
|
|
|
|
|
printf("Too high! Try again.\n"); |
|
|
|
|
|
} else if (guess < secret_number) { |
|
|
|
|
|
printf("Too low! Try again.\n"); |
|
|
|
|
|
} else { |
|
|
|
|
|
printf("Congratulations, you found the secret number!\n"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void play_guessingGame() { |
|
|
void play_guessingGame() { |
|
|
printf("**********************\n"); |
|
|
|
|
|
printf("Playing Guessing Game!\n"); |
|
|
|
|
|
printf("**********************\n"); |
|
|
|
|
|
|
|
|
printf("*************************\n"); |
|
|
|
|
|
printf("Playing Guess the Number!\n"); |
|
|
|
|
|
printf("*************************\n\n"); |
|
|
v_guessingGame(); |
|
|
v_guessingGame(); |
|
|
printf("****************************************\n"); |
|
|
printf("****************************************\n"); |
|
|
printf("Thank you for playing the Guessing Game!\n"); |
|
|
|
|
|
|
|
|
printf("Thank you for playing Guess the Number!\n"); |
|
|
printf("****************************************\n"); |
|
|
printf("****************************************\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|