Can anyone post me a sample program!

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
Suraj Joshi
Newbie
Posts: 3
Joined: Wed Jul 21, 2010 2:49 am

Can anyone post me a sample program!

Post by Suraj Joshi » Wed Oct 06, 2010 7:04 am

Can anyone post me(or tell me where i can find) a qbasic sample program
which have following Features:-
1.Written in modular form.
2.Menu Based
3.Have capability to save data in files.
4.Kinda data managing program.
5.And lastly not very simple but complex.


Thanks :D

User avatar
burger2227
Veteran
Posts: 2373
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Wed Oct 06, 2010 8:30 pm

What kind of data?

What kind of file? CSV or what?

Need more info. My demonstrator (Q-Basics) shows how to do many things in QB or QB64. QB64 is compatible with newer computers.

http://dl.dropbox.com/u/8440706/Q-Basics.zip

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Post by bongomeno » Wed Oct 06, 2010 11:21 pm

my guess is that he has some class where he is supposed to make some sort of menu based general purpose database (phonebook?).
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

User avatar
burger2227
Veteran
Posts: 2373
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Thu Oct 07, 2010 12:22 am

Well I won't do homework for anybody, that's for sure!

Ya never know for sure though.

Haven't seen you around much Bongo, where ya been?
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Suraj Joshi
Newbie
Posts: 3
Joined: Wed Jul 21, 2010 2:49 am

:D

Post by Suraj Joshi » Sun Oct 10, 2010 1:11 am

Yeh ! Bongomeno u r right ( some sort of menu based general purpose database ). Its a project work but i dont know what to make, a phonebook
or other of the same kind so i needed some sample programs to get help.
Can u post it or any url . Any idea or suggestions what to make would be
appreciated. Thanks

User avatar
burger2227
Veteran
Posts: 2373
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Sun Oct 10, 2010 5:09 am

Code: Select all


'Demo using a TYPE definition to create a file
 '*****************
TYPE ClientType
   CName AS STRING * 30     '30 bytes
   Address AS STRING * 30   '30 bytes 
   City   AS STRING * 15    '15 bytes
   State  AS STRING * 2     ' 2 bytes
   Zip    AS STRING * 5     ' 5 bytes
END TYPE      ' total size = 82 bytes
DIM Client AS ClientType
RecordLEN = LEN(Client)       'find the size of each TYPE record

OPEN "ADDRESS.DAT" FOR RANDOM AS #1 LEN = RecordLEN
RESTORE ClientData         'restore to start of DATA
record = 0
DO
   READ CName$, Address$, City$, State$, Zip$       'read DATA
   IF CName$ = "END" THEN EXIT DO
   record = record + 1               'increment record number
   Client.CName = CName$          
   Client.Address = Address$
   Client.City = City$
   Client.State = State$
   Client.Zip = Zip$
   PUT #1, record, Client     'PUT by record number
LOOP
CLOSE #1
END

ClientData:
   DATA "Bob White","104 Birdland Rd.","Bellview","PA","15236"
   DATA "Ward Cleaver","123 W. Beaver St.","Beaver","PA","15255"
   DATA "Elmer Fudd","45 Wabbit St.","Bethel Park","PA","15022"
   DATA "Wyley Coyote","33 Roadrunner Ave.","Clairton","PA","15122"
   DATA "Jim Morrison","19 Doorway Dr.","Belleview","PA","15236"
   DATA "END",0,0,0,0,0  

Code: Select all

'Demo of the FIELD statement to read the file
'*********************************************************************
' Define field and record lengths with constants.
CONST NM = 30, AD = 30, CT = 15, ST = 2, ZC = 5
CONST RLEN = NM + AD + CY + ST + ZC
'
OPEN "ADDRESS.DAT" FOR RANDOM AS #1 LEN = RLEN
FIELD #1, NM AS CName$, AD AS Address$, CY AS City$, ST AS State$, ZC AS Zip$
FIELD #1, RLEN AS Clist$         'define entire record

GET #1, 1                  'GET does not need a variable to read FIELD records!
                                  'Read file for zip codes from 15230 to 15239 .
DO WHILE NOT EOF(1)
   ZipCheck$ = Zip$                            'read zip codes
   IF (ZipCheck$ >= "15230" AND ZipCheck$ <= "15239") THEN
      Info$ = Clist$
      PRINT LEFT$(Info$, 30)     'read name string
      PRINT MID$(Info$, 31, 30)  'read address string
      PRINT RIGHT$(Info$, 17)    'read city, state and zip code
      PRINT
   END IF
   GET #1                               'simply GET reads each FIELD record after first
LOOP
CLOSE #1
END
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Suraj Joshi
Newbie
Posts: 3
Joined: Wed Jul 21, 2010 2:49 am

Post by Suraj Joshi » Sun Oct 10, 2010 8:26 pm

Thanks ! It will be useful.

Post Reply