aboutsummaryrefslogtreecommitdiff
path: root/games/gameguess.c
diff options
context:
space:
mode:
authordavid <[email protected]>2026-05-04 06:25:40 -0300
committerdavid <[email protected]>2026-05-04 06:25:40 -0300
commitf161c1e4a9cb7393b7fd155a6bcab28b2ca94565 (patch)
tree0250ca4178ac9b26ccd279aeae9ebff0241b4277 /games/gameguess.c
parent112351f9bc0d6a80f9e25b1c69de80b573b3d7c4 (diff)
downloadpetratc-f161c1e4a9cb7393b7fd155a6bcab28b2ca94565.tar.gz
petratc-f161c1e4a9cb7393b7fd155a6bcab28b2ca94565.zip
fixed stupid things happening if you're stupid
Diffstat (limited to 'games/gameguess.c')
-rw-r--r--games/gameguess.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/games/gameguess.c b/games/gameguess.c
index ad6c9be..940e4c5 100644
--- a/games/gameguess.c
+++ b/games/gameguess.c
@@ -14,7 +14,10 @@ printf("let's play a game, squeak!~ you gues a number between 0 and %d!\n", rang
while(solved != 1){
-scanf("%d", &guess);
+if(scanf("%d", &guess) != 1){
+ while(getchar() != '\n'); //flush the bad input here too
+ continue;
+}
if(guess < correct){
printf("number too low try again\n");