Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 0.69 KB | None | 0 0
  1. SUB ValidateOption (Choice$, Min, Max, Flag)
  2. REM This subroutine will ensure that the OPTION selcted was valid. IF it IS valid
  3. REM Flag = 0, IF NOT Flag = 1
  4. PRINT
  5. SELECT CASE INT(VAL(Choice$))
  6.     CASE IS > Max
  7.         Flag = 1
  8.         PRINT "Sorry, but the value you have entered is far too big"
  9.         PRINT "Please choose again between"; Min; "and"; Max
  10.     CASE IS < Min
  11.         Flag = 1
  12.         PRINT "Sorry, but the value you have entered is far too small"
  13.         PRINT "Please choose again between"; Min; "and"; Max
  14.     CASE IS > Min AND < Max
  15.         Flag = 0
  16.     CASE ELSE
  17.         Flag = 1
  18.         PRINT "Please choose a number between"; Min; "and"; Max
  19. END SELECT
  20. END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement