home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / flow / exam10.dba < prev    next >
Encoding:
Text File  |  2000-05-22  |  1.3 KB  |  66 lines

  1. Rem * Title  : ARRAY Commands
  2. Rem * Author : DBS-MB
  3. Rem * Date   : 1st August 99
  4. rem ===========================================================
  5. rem DARK BASIC EXAMPLE PROGRAM 10
  6. rem ===========================================================
  7. rem This program will show you how to use the dim command
  8. rem -----------------------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),1
  12.     
  13. rem Reserve room for 10 numbers
  14. dim a(10)
  15.  
  16. rem Reserve room for 10 string max size 255 chars
  17. dim a$(10)
  18.  
  19. rem Read 10 number into the array
  20. for t=1 to 10    
  21.     read a(t)
  22. next t
  23.  
  24. rem Read 10 string into the array
  25. for t=1 to 10
  26.     read a$(t)
  27. next t
  28.  
  29. rem Print out 10 number and 10 strings
  30. for t=1 to 10
  31.     print a(t);
  32.     print a$(t)
  33. next t
  34.  
  35. rem Now we will save the array
  36. print "saving array"
  37. save array "test",a(0)
  38.  
  39. rem Now we will load the array back
  40. print "load array"
  41. load array "test",a(0)
  42.  
  43. rem Wait for key
  44. print "please press spacekey"
  45. suspend for key
  46.  
  47. rem Print out 10 number and 10 strings again
  48. cls
  49. for t=1 to 10
  50.     print a(t);
  51.     print a$(t)
  52. next t
  53.  
  54. rem Free memory use by a(10)
  55. undim a(10)
  56.  
  57. rem Free memory use by a$(10)
  58. undim a$(10)        
  59.  
  60. rem End of program
  61. end
  62.  
  63. data 1,2,3,4,5,6,7,8,9,10
  64. data "a","b","c","d","e","f","g","h","i","j"
  65.  
  66.