aboutsummaryrefslogtreecommitdiff
path: root/petratc.c
diff options
context:
space:
mode:
Diffstat (limited to 'petratc.c')
-rw-r--r--petratc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/petratc.c b/petratc.c
index 5889f89..0a60b46 100644
--- a/petratc.c
+++ b/petratc.c
@@ -109,12 +109,15 @@ int truing = 1;
while(truing){
printf("1: play a game! (fun up), 4: take a shower! (clean up), 9: print me!, 0: exit...\n");
- scanf("%d", &choice);
+
+ if(scanf("%d", &choice) != 1){
+ while(getchar() != '\n'); //flush the bad input if you're a bad boy and put q instead of 1
+ continue;
+ }
switch(choice){
case 1: gameguess(); break;
case 4: gamecatch(); break;
- case 8: printf("%d\n", rat.age); break;
case 9: printrat(); break;
case 0: truing = 0; break;
}