/* File: sure.c Check if the user really wanted to break the bank. */ #include #include "genlib.h" #include "simpio.h" #include "strlib.h" main() { int balance, entry ; bool done ; string reply ; printf("Balance = ") ; balance = GetInteger() ; done = FALSE ; while (!done) { printf("Entry = ") ; entry = GetInteger() ; if (balance + entry >= 0) { done = TRUE ; } else { printf("Are you sure? [y/n] ") ; reply = GetLine() ; if (StringEqual(reply, "y")) done = TRUE ; } } balance += entry ; printf("balance = %d\n", balance) ; }