diff options
| author | david <[email protected]> | 2026-05-04 06:25:40 -0300 |
|---|---|---|
| committer | david <[email protected]> | 2026-05-04 06:25:40 -0300 |
| commit | f161c1e4a9cb7393b7fd155a6bcab28b2ca94565 (patch) | |
| tree | 0250ca4178ac9b26ccd279aeae9ebff0241b4277 /petratc.c | |
| parent | 112351f9bc0d6a80f9e25b1c69de80b573b3d7c4 (diff) | |
| download | petratc-f161c1e4a9cb7393b7fd155a6bcab28b2ca94565.tar.gz petratc-f161c1e4a9cb7393b7fd155a6bcab28b2ca94565.zip | |
fixed stupid things happening if you're stupid
Diffstat (limited to 'petratc.c')
| -rw-r--r-- | petratc.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |
