home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_16_1987_Transactor_Publishing.d64 / struct.ex (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  1KB  |  67 lines

  1. 100 '
  2. 103 ' structured demo -- frank digioia
  3. 105 '
  4. 110 call prompt
  5. 120 while a$<>"x"
  6. 130     if a$="c" then call create:else call read
  7. 140     call prompt
  8. 150 wend
  9. 160 end
  10. 170 :
  11. 200 proc create
  12. 205 call get-name
  13. 210 open2,8,2,f$+",w"
  14. 212 print"enter data..."
  15. 215 call get-key
  16. 220 repeat
  17. 225     print a$;
  18. 230     print#2,a$;
  19. 235     repeat
  20. 240         call get-key
  21. 245         print a$;
  22. 247         print#2,a$;
  23. 250     until a$ = chr$(13)
  24. 255     call get-key
  25. 260 until a$=chr$(13)
  26. 265 print#2:close2
  27. 270 return
  28. 275 :
  29. 300 proc read
  30. 310 call get-name
  31. 320 open2,8,2,f$
  32. 330 while st=0
  33. 340     get#2,a$
  34. 350     print a$;
  35. 360 wend
  36. 370 close2
  37. 380 return
  38. 390 :
  39. 400 proc get-valid-key
  40. 410 repeat
  41. 420     call get-key
  42. 430 until a$="c" or a$="d" or a$="x"
  43. 440 return
  44. 450 :
  45. 500 proc get-key
  46. 510 a$=""
  47. 520 while a$=""
  48. 530     get a$
  49. 540 wend
  50. 550 return
  51. 560 :
  52. 600 proc get-name
  53. 610 f$=""
  54. 620 while f$=""
  55. 630     input"filename";f$
  56. 640 wend
  57. 650 return
  58. 660 :
  59. 700 proc prompt
  60. 710 print"type c to create a data file"
  61. 720 print"type d to display a data file"
  62. 730 print"type x to exit program"
  63. 740 print"note: when creating a data file"
  64. 750 print"hit <return> twice to end input"
  65. 760 call get-valid-key
  66. 770 return
  67.