home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / sbasics.lbr / MATH1.BZS / MATH1.BAS
Encoding:
BASIC Source File  |  1993-10-25  |  2.6 KB  |  106 lines

  1. 10    text 0,&
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. ********************************************************************************                      THIS IS THE MATH QUIZ GAME
  9. ********************************************************************************
  10.  
  11.  
  12.  
  13. INPUT ONE OF THE FOLLOWING SYMBOLS FOR THE MATH OPERATION YOU WANT TO TRY:
  14.  
  15. INPUT "+" FOR ADDITION
  16. INPUT "-" FOR SUBTRACTION
  17. INPUT "*" FOR MULTIPLICATION
  18. INPUT "/" FOR DIVISION
  19. INPUT "Q" WHEN YOU WANT TO QUIT THIS GAME
  20.  
  21. TO CHANGE THE TYPE OF MATH OPERATION YOU WANT TO DO, TYPE -1  WHEN THE COMPUTER
  22. GIVES YOU A NEW PROBLEM.
  23. &
  24. 20    var o$,a$=string:10
  25. 30    var j,k,t,i,a=integer
  26. 40    var m,n,l,p=real
  27. 50    dim com string o$(10) a$(1)
  28. 60    let o$="+-*/Qq"
  29. 145    print "INPUT MATH OPERATION SYMBOL ";
  30. 150    input a$
  31. 155    rem   find out the operation number of the math symbol
  32. 160    gosub 495
  33. 165    print "INPUT THE LOWER AND UPPER LIMITS OF YOUR NUMBERS (L,U) ";
  34. 170    input j,k
  35. 175    print "INPUT THE NUMBER OF INCORRECT ANSWERS YOU ARE ALLOWED ";
  36. 180    input t
  37. 185    rem    get 2 random numbers for m and n
  38. 190    gosub 370
  39. 195    i=0
  40. 200    on a goto 210,245,285,325
  41. 205    rem    routine for addition
  42. 210    l=m+n
  43. 215    print m;" + " ; n ; " = ";
  44. 220    input p
  45. 225    if p<0 then 145
  46. 230    if p=l then 435
  47. 235    gosub 455
  48. 240    goto 220
  49. 245    rem    routine for subtraction
  50. 250    l=m-n
  51. 255    print m;" - " ; n ; " = ";
  52. 260    input p
  53. 265    if p<0 then 145
  54. 270    if p=l then 435
  55. 275    gosub 455
  56. 280    goto 260
  57. 285    rem    routine for multiplication
  58. 290    l=m*n
  59. 295    print m;" * " ; n ; " = ";
  60. 300    input p
  61. 305    if p<0 then 145
  62. 310    if p=l then 435
  63. 315    gosub 455
  64. 320    goto 300
  65. 325    rem    routine for division
  66. 330    l=m/n
  67. 335    print m;" / " ; n ; " = ";
  68. 340    input p
  69. 345    if p<0 then 145
  70. 350    if p=l then 435
  71. 355    gosub 455
  72. 360    goto 300
  73. 370    rem    subroutine--finds 2 random numbers within the limits of j & k
  74. 375    m=int(rnd(rnd(1)*10)*k+1)
  75. 380    if m<j then 375
  76. 385    n=int(rnd(1)*k+1)
  77. 390    if n<j then 385
  78. 395    if a=1 then 425
  79. 400    if a=3 then 425
  80. 405    if m<=n then 375
  81. 415    if int(m/n)*n=(m/n)*n then 425
  82. 420    goto 375
  83. 425    return
  84. 435    rem    subroutine--prints if response is correct
  85. 440    print "YOU ARE RIGHT!"
  86. 445    goto 190
  87. 455    rem    subroutine--prints if response is wrong
  88. 460    i=i+1
  89. 465    if i>=t then 480
  90. 470    print "SORRY, YOUR ANSWER IS WRONG...PLEASE TRY AGAIN ";
  91. 475    return
  92. 480    print "THAT IS " ; i ; " TRIES"
  93. 485    print "THE CORRECT ANSWER IS ";l
  94. 490    goto 190
  95. 495    rem    subroutine--gets the operation number from a$
  96. 505    a=1
  97. 510    if a$=mid$(o$,a,1) then 530
  98. 511    a=a+1
  99. 515    if a>6 then 520 else 510
  100. 520    print "TYPE +,-,*,/ OR Q"
  101. 525    goto 145
  102. 530    if a=5 then 540
  103. 531    if a=6 then 540
  104. 535    return
  105. 540    end
  106.