#include <stdio.h>
#include <stdlib.h> // For rand() and srand()
#include <time.h> // for time() function
#include <ctype.h>
int i,j,k;
void f1()
{
; j<=-i; j++)
printf(" ");
}
void f2()
{
; k<=*i+; k++)
printf();
}
int main(void)
{
;
;
;
;
char select = '\0';
printf("Please enter the range you want(1~1000): ");
scanf("%d", &limit);
|| limit > ){
printf("The number range which you can set are 1 ~ 1000, please set gain: ");
scanf("%d", &limit);
}
do{
srand(time(NULL));
chosen = + rand() % limit;
printf("This is a guessing game.");
printf("\nYou have chosen a number between 1 and %d.", limit);
count = ;
; --count)
{
printf( ? "y" : "ies");
printf("Enter a guess: ");
scanf("%d", &guess);
if (guess == chosen)
{
printf("\nCongranturations. You guess it!\nAs a award, I sent you a love:\n");
printf(,,,);
; i<=; i++)
{
f1();
f2();
f1();
f1();
f2();
f1();
printf("\n");
}
; i<=; i++)
{
; j<=i-; j++)
printf(" ");
; k<=-*i; k++)
printf();
printf("\n");
}
;
}
|| guess > )
printf("The range is 1 ~ 1000");
else
printf("Sorry, %d is wrong, My number is %s than that.\n",
guess, chosen > guess ? "greater" : "less");
}
printf("\nYou have had three tries and failed. The number was %d.\n", chosen);
printf("\nDo you want to play again(y or n)? ");
getchar();
scanf("%c", &select);
}while(toupper(select) == 'Y');
;
}