program help (if you have a free sec)
Posted: Thu Jul 17, 2008 1:06 pm
I'm trying to make a program that will help me memorize bible verses, but it's got a problem. (could be my lousdy programming. If anyone reading has a sec, read on...
It randomly picks a verse from the file verses.txt (see bottom of post for txt sample) and then asks you for the reference. It lowercases the refernce and compares it to the reference (ref's follow verses in txt file)
You must get three right to close the program.
(On a side note, if I put this in my startup folder and have three wrong guess cause a logoff, can QB run XP's logoff and shutdown commands?)
RANDOMIZE TIMER
'open file
OPEN "c:\qbasic\verses.txt" FOR INPUT AS #1
'clear variable "count"
count1 = 0
count2 = 0
start: CLS
'randomly determine which line of file to read
num = INT(RND * 3) + 1
'skips through file to specified line
FOR count = 1 TO num
INPUT #1, verse$
INPUT #1, reference$
NEXT count
'the verse display and user prompt
PRINT verse$
PRINT
INPUT " Reference?: "; guess$
'if verse # selected (count) is same as last one/two used, get another number
'(start over)
IF count = used1 OR count = used2 THEN GOTO start
'stores used verses so no verse is used twice
IF count1 = 0 THEN count = used1
IF count1 <> 0 AND count2 = 0 THEN count = used2
'checking guess with reference
guess$ = LCASE$(guess$)
IF guess$ = reference$ THEN PRINT : PRINT "Correct!": SLEEP 2: correctnum = correctnum+1
IF guess$ <> reference$ THEN PRINT : PRINT "wrong": GOTO start
IF correctnum = 3 THEN PRINT "Nice job!"
IF correctnum < 3 THEN GOTO start
verses.txt (sample, verses aren't real)
everyone has sinned, rom 2:20
Jesus loves you, matt 12:1
pray often, john 14:1
in the beginning, gen 1:1
If anything is unclear, post your questions.
Thanks for your time,
Agent_Firestalker
It randomly picks a verse from the file verses.txt (see bottom of post for txt sample) and then asks you for the reference. It lowercases the refernce and compares it to the reference (ref's follow verses in txt file)
You must get three right to close the program.
(On a side note, if I put this in my startup folder and have three wrong guess cause a logoff, can QB run XP's logoff and shutdown commands?)
RANDOMIZE TIMER
'open file
OPEN "c:\qbasic\verses.txt" FOR INPUT AS #1
'clear variable "count"
count1 = 0
count2 = 0
start: CLS
'randomly determine which line of file to read
num = INT(RND * 3) + 1
'skips through file to specified line
FOR count = 1 TO num
INPUT #1, verse$
INPUT #1, reference$
NEXT count
'the verse display and user prompt
PRINT verse$
INPUT " Reference?: "; guess$
'if verse # selected (count) is same as last one/two used, get another number
'(start over)
IF count = used1 OR count = used2 THEN GOTO start
'stores used verses so no verse is used twice
IF count1 = 0 THEN count = used1
IF count1 <> 0 AND count2 = 0 THEN count = used2
'checking guess with reference
guess$ = LCASE$(guess$)
IF guess$ = reference$ THEN PRINT : PRINT "Correct!": SLEEP 2: correctnum = correctnum+1
IF guess$ <> reference$ THEN PRINT : PRINT "wrong": GOTO start
IF correctnum = 3 THEN PRINT "Nice job!"
IF correctnum < 3 THEN GOTO start
verses.txt (sample, verses aren't real)
everyone has sinned, rom 2:20
Jesus loves you, matt 12:1
pray often, john 14:1
in the beginning, gen 1:1
If anything is unclear, post your questions.
Thanks for your time,
Agent_Firestalker