#pragma warning(disable:4996)
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
int throwDice();
int getUserGuess();
void playGuessingGame();
int throwDice()
{
return rand() %6 + 1;
}
int getUserGuess()
{
int guess;
printf("Guess the number of the dice. (1에서 6까지): ");
scanf("%d", &guess);
return guess;
}
void playGuessingGame()
{
int userGuess, diceResult;
do{
userGuess = getUserGuess();
diceResult = throwDice();
printf("Result of the number: %d\n", diceResult);
if(userGuess == diceResult){
printf("Congratulation! Got it right!\n");
}
else{
printf("Sorry, Try again.\n");
}
}while(userGuess != 0);
}
int main()
{
srand(time(NULL));
printf("Start the game of guessing the dice number.\n");
playGuessingGame();
printf("End\n");
return 0;
}