Untitled
Never
/* PROJECT: C Premier Plus exercise 8 - 5 PURPOSE: "Modify the guessing program of Listing 8.4 so that it uses a more intelligent guessing strategy. For example, Have the program initially guess 50, and have it ask the use whether the guess is high, low or correct. If, say, the guess is low, have the next guess be half way between 50 and 100, that is, 75. If the guess is high, let the next guess be half way between 75 and 50, and so on. Using this Binary search strategy, the program quickly zeros in on the correct answer, at least if the user does not cheat. DATES: 30 may '19, afternoon - */ #include <stdio.h> /* The program will ask the user if the want to play a game, if they accede offer the first guess and ask if it is correct IF The guess should go higher add a variable equal to a half of the guess and keep adding until the users says lower If the question should go lower Split the guess by a variable that starts at a half of the guess and keep halving until the user says higher */ int main (void) { int Guess = 50, UpStep = 25, LoStep = 2; char Status, Answer = '\0', Step = '\0'; //I already tried not initializing //these variables but the same //error keeps happening printf("Lets play a game, shall we?\n[Y]es?\n[N]o?\n"); scanf("%c", &Status); if ((Status == 'N') || (Status == 'n')) /*exit message*/ { printf("\nOh well, see you then"); return 0; } if ((Status == 'Y') || (Status == 'y')) /*begin of the game*/ { printf("\nThink of a number from 1 to 100"); printf("\nIs it %d ?", Guess); printf("\n[Y]es or [N]o?\n"); scanf("%c", & Answer);//The program is going from this line to the //error message on line 81 if ((Answer == 'Y') || (Answer == 'y')) /*congrats message*/ { printf("\nGreat!"); printf("\nWanna play again?"); scanf("%d", &Status); } if ((Answer == 'N') || (Answer == 'n')) /*game loop*/ { printf("\nShould it be [h]igher or [l]ower?"); scanf("%c", & Step); if ((Step == 'H') || (Step == 'h')) /*Up Movement*/ { Guess = Guess + UpStep; UpStep = UpStep + 1; LoStep = LoStep - 1; } if ((Step == 'L') || (Step == 'l')) /*Down movement*/ { Guess = Guess / LoStep; LoStep = LoStep + 1; UpStep + UpStep / LoStep; } else /*error message*/ { printf("\nThat's not an acceptable answer"); printf("\nPlease use H or L"); scanf("%c", & Step); } printf ("Is it %d ?"); scanf("%c", & Answer); } else /*error message*/ { printf("\nThat's not an acceptable answer"); printf("\nPlease use Y or N"); scanf("%c", & Answer); } } else /*error message*/ { printf("\nThat's not an acceptable answer"); printf("\nplease use 'y' or 'n'"); scanf("%d", &Status); } }
Raw Text
-
GOTFILLED A craving for Lysagna Delray
25 min ago
-
Untitled
30 min ago
-
CP🍭 VIDEO😏 R@PED😈 SLEEPING💤 GIRL 7yo🙈👧
36 min ago
-
I’m obsessed with anal, that's what makes me happy
56 min ago
-
Bgbrew
1 hour ago
-
brygfuibfjkdbdf
1 hour ago
-
https://www.theoaklandpress.com/2024/04/16/fitspresso-reviews-weight-loss-complaint-read-fitspresso-
1 hour ago
-
Yanks Amateur Babe Sierra Skillfully Eats Endza's Pussy
1 hour ago
-
Roleplay-Tu prima Colombiana esta de visita y quiere que le muestres todo.
1 hour ago
-
Veronica Leal surprises Stacy Cruz with her dick and destroys her tight asshole
2 hours ago