The QBasic Forum     RULES     Other Subforums, Links and Downloads    Index of Threads

 Return to Index  

"Study Helper" made in QBasic 7.1 (runs in 4.5 and up)

May 12 2004 at 6:38 PM
ComputerGhost  (no login)


Response to ProgramList ComputerGhost

'This program was made by ComputerGhost in the year 2003 A.D.
'Instructions for use are as follows:
'This program is to be used for studying purposes.  The instructions
'that it gives while running are good enough for you to figure out
'how to operate this.  I suggest running the program once, then twice
'three to five hours later for maximum results.  If you have any
'questions or complaints about this program, email me at
'ComputerGhost@hotmail.com.

DECLARE SUB EditQuestions ()
DECLARE SUB LoadProg ()
DECLARE FUNCTION inputs$ (max%, numtogl%)
DECLARE SUB Install ()
DECLARE SUB reget (numbers%, op%)
DECLARE SUB Save ()

DIM SHARED totalq%, PreQ$, Punct$, eoccur%, minst%

ON ERROR GOTO 100

TYPE regstype
 ax AS INTEGER
 bx AS INTEGER
 cx AS INTEGER
 dx AS INTEGER
 bp AS INTEGER
 si AS INTEGER
 di AS INTEGER
 flags AS INTEGER
END TYPE
DIM SHARED regs AS regstype

LoadProg

40 CLS
VIEW PRINT 1 TO 25
COLOR 15, 0
CLS
COLOR 15, 2
PRINT STRING$(80, " ")
LOCATE 1, 7
COLOR 0
PRINT "for lack of a better name...  ";
COLOR 4
PRINT "THIS"

COLOR 2, 0
PRINT "This will help you study for classes like French, Spanish, History, etc.  To use"
PRINT "this, first type in all the questions that you want it to ask, and then type in"
PRINT "the answers.  This will then ask you questions, and keep up with how many you"
PRINT "get right."
COLOR 6
PRINT CHR$(13); "Question:"

COLOR 1
PRINT STRING$(160, "Û")
COLOR 0, 7
LOCATE 8, 80: PRINT CHR$(24);
LOCATE 9, 80: PRINT CHR$(25);
COLOR 15, 0
PRINT CHR$(13); "Answer:"
COLOR 4
PRINT STRING$(80, "Û")
COLOR 14
LOCATE 14
PRINT "Questions Correct:"
COLOR 7
LOCATE 17
PRINT "Type in ^EXIT and press enter, or press Esc and press enter to exit."
LOCATE 24, 6
COLOR 14, 4
PRINT "Click here or press Ctrl+A to edit the questions and their answers."

RANDOMIZE TIMER \ 3
REDIM SHARED Answer$(1)
REDIM SHARED Questions$(1)
reget 0, 0

place% = 1
aplace% = 1
qnum% = INT(RND * totalq%) + 1
20 LOCATE 8, 1
 COLOR 11, 1
 text$ = PreQ$ + " " + Questions$(qnum%) + Punct$
 PRINT STRING$(79, " "): PRINT STRING$(79, " ")
 LOCATE 8, 1
 PRINT MID$(text$, place%, 79)
 PRINT MID$(text$, place% + 79, 79)
 COLOR 14, 4
 LOCATE 12, 1
 A% = aplace% - 78
 IF A% < 1 THEN A% = 1
 PRINT MID$(answers$, A%, 78); "Û "
 regs.ax = 1: CALL interrupt(&H33, regs, regs)
 DO
  cmd$ = INKEY$
  regs.ax = 3: CALL interrupt(&H33, regs, regs)
  IF regs.bx > 0 AND regs.cx = 632 AND regs.dx = 56 THEN cmd$ = CHR$(0) + "I"
  IF regs.bx > 0 AND regs.cx = 632 AND regs.dx = 64 THEN cmd$ = CHR$(0) + "Q"
  IF regs.bx > 0 AND regs.dx = 184 THEN cmd$ = CHR$(1)
  IF regs.bx > 0 AND regs.dx = 128 THEN END
 LOOP UNTIL cmd$ <> ""
 timers = TIMER
 DO
  regs.ax = 3: CALL interrupt(&H33, regs, regs)
 LOOP UNTIL regs.bx = 0 OR timers + .1 < TIMER
 regs.ax = 2: CALL interrupt(&H33, regs, regs)
 l% = LEN(answers$)
 SELECT CASE cmd$
  CASE CHR$(8)
   IF l% > 0 THEN answers$ = LEFT$(answers$, l% - 1): aplace% = aplace% - 1
  CASE CHR$(0) + "I"
   IF place% > 79 THEN place% = place% - 79
  CASE CHR$(0) + "Q"
   IF place% < 1501 THEN place% = place% + 79
  CASE CHR$(13)
   A$ = RTRIM$(UCASE$(answers$))
   b$ = RTRIM$(UCASE$(Answer$(qnum%)))
   IF A$ = "^EXIT" THEN END
   IF A$ = b$ THEN right% = right% + 1
   total% = total% + 1
   COLOR 15, 0
   LOCATE 14, 19
   PRINT INT((right% / total%) * 100); "%  "
   IF A$ <> b$ THEN
    COLOR 30, 0
    PRINT LEFT$(b$, 80);
    SLEEP
    DO: null$ = INKEY$: LOOP UNTIL null$ = ""
    LOCATE 15, 1
    PRINT STRING$(80, " ")
   END IF
   qnum% = INT(RND * totalq%) + 1
   answers$ = ""
   LOCATE 12
   COLOR 4, 0
   PRINT STRING$(80, "Û")
   PRINT STRING$(80, " ")
  CASE CHR$(1)'CTRL+A
   EditQuestions
   GOTO 40
  CASE CHR$(27)
   answers$ = "^EXIT" + STRING$(l% - (1 + (l% < 5)) * 5, " ")
  CASE ELSE
   IF cmd$ < " " THEN GOTO 20
   IF l% < 500 THEN answers$ = answers$ + cmd$: aplace% = aplace% + 1
 END SELECT
GOTO 20

DATA "lundi", "Monday"
DATA "mardi", "Tuesday"
DATA "mercredi", "Wednesday"
DATA "jeudi", "Thursday"
DATA "vendredi", "Friday"
DATA "samedi", "Saturday"
DATA "dimanche", "Sunday"
DATA "janvier", "January"
DATA "f‚vrier", "February"
DATA "mars", "March"
DATA "avril", "April"
DATA "mai", "May"
DATA "juin", "June"
DATA "julliet", "July"
DATA "ao–t", "August"
DATA "septembre", "September"
DATA "octobre", "October"
DATA "novembre", "November"
DATA "d‚cembre", "December"

100 eoccur% = ERR
RESUME NEXT

SUB EditQuestions
COLOR 15, 0
FOR i% = 2 TO 25
 LOCATE i%, 1
 PRINT STRING$(80, " ");
NEXT i%
LOCATE 2, 1
COLOR 2
PRINT "This is where you change the questions and answers for This.  Use the up and"
PRINT "down arrow keys to move up or down to other options.  Press Enter to edit"
PRINT "part of the question.  +(plus) and -(minus) can be used to move up or down a"
PRINT "question.  You could also just type in the number of the question that you want"
PRINT "to edit.  The Esc key goes ";
COLOR 14: PRINT "back";
COLOR 2: PRINT ".  Ctrl+R ";
COLOR 14: PRINT "reset";
COLOR 2: PRINT "s everything.  You can click on";
PRINT "the highlighted words in this paragraph to go back or to reset everything."
COLOR 15: PRINT "NOTE:  Everything that you change is automatically saved."

10 COLOR 7, 1
LOCATE 10, 5
PRINT "É"; STRING$(70, "Í"); "»"
FOR i% = 11 TO 18
 LOCATE i%, 5
 PRINT "º"; STRING$(70, " "); "º"
NEXT i%
LOCATE 19, 5
PRINT "È"; STRING$(70, "Í"); "¼"

LOCATE 11, 6
COLOR 2
PRINT "Question Number:"
LOCATE , 6
PRINT "First Part of all Questions:"
LOCATE 14, 6
PRINT "Question:"
LOCATE 15, 6
PRINT "Punctuation/End of all Questions:"
LOCATE 17, 6
PRINT "Answer:"

COLOR 7, 0
LOCATE 20, 1
PRINT "Example:"

COLOR 11, 1
LOCATE 11, 22
PRINT qnum% + 1

LOCATE 12, 35
PRINT LEFT$(PreQ$, 41)
LOCATE 13, 6
PRINT MID$(PreQ$, 42, 70)

LOCATE 14, 16
PRINT LEFT$(Questions$(qnum% + 1), 59)

LOCATE 15, 40
PRINT LEFT$(Punct$, 36)
LOCATE 16, 6
PRINT MID$(Punct$, 37, 70)

LOCATE 17, 14
PRINT LEFT$(Answer$(qnum% + 1), 61)
LOCATE 18, 6
PRINT MID$(Answer$(qnum% + 1), 62, 70)

COLOR 12, 0
FOR i% = 21 TO 25
 LOCATE i%, 1
 PRINT STRING$(80, " ");
NEXT i%
LOCATE 21, 1
text$ = PreQ$ + " " + Questions$(qnum% + 1) + Punct$
PRINT LEFT$(text$, 160)
COLOR 13
PRINT LEFT$(Answer$(qnum% + 1), 160)

COLOR 10, 1
SELECT CASE mey%
 CASE 0
  LOCATE 11, 6
  PRINT "Question Number:"
  COLOR 14
  LOCATE 11, 22
  PRINT qnum% + 1
 CASE 1
  LOCATE 12, 6
  PRINT "First Part of all Questions:"
  COLOR 14
  LOCATE 12, 35
  PRINT LEFT$(PreQ$, 41)
  LOCATE 13, 6
  PRINT MID$(PreQ$, 42, 70)
 CASE 2
  LOCATE 14, 6
  PRINT "Question:"
  COLOR 14
  LOCATE 14, 16
  PRINT LEFT$(Questions$(qnum% + 1), 60)
 CASE 3
  LOCATE 15, 6
  PRINT "Punctuation/End of all Questions:"
  COLOR 14
  LOCATE 15, 40
  PRINT LEFT$(Punct$, 36)
  LOCATE 16, 6
  PRINT MID$(Punct$, 37, 70)
 CASE 4
  LOCATE 17, 6
  PRINT "Answer:"
  COLOR 14
  LOCATE 17, 14
  PRINT LEFT$(Answer$(qnum% + 1), 61)
  LOCATE 18, 6
  PRINT MID$(Answer$(qnum% + 1), 62, 70)
END SELECT

regs.ax = 1: CALL interrupt(&H33, regs, regs)
DO
 cmd$ = INKEY$
 regs.ax = 3: CALL interrupt(&H33, regs, regs)
 IF regs.bx > 0 AND regs.dx > 79 AND regs.dx < 137 THEN cmd$ = CHR$(0) + "H"
 IF regs.bx > 0 AND regs.dx = 80 THEN mey% = 1
 IF regs.bx > 0 AND regs.dx > 87 AND regs.dx < 97 THEN mey% = 2
 IF regs.bx > 0 AND regs.dx = 104 THEN mey% = 3
 IF regs.bx > 0 AND regs.dx > 111 AND regs.dx < 121 THEN mey% = 4
 IF regs.bx > 0 AND regs.dx > 127 AND regs.dx < 137 THEN mey% = 5
 IF regs.bx > 0 AND regs.cx > 215 AND regs.cx < 241 AND regs.dx = 40 THEN cmd$ = CHR$(27)
 IF regs.bx > 0 AND regs.cx > 327 AND regs.cx < 361 AND regs.dx = 40 THEN cmd$ = CHR$(18)
LOOP UNTIL cmd$ <> ""

timers = TIMER
DO
regs.ax = 3: CALL interrupt(&H33, regs, regs)
LOOP UNTIL regs.bx = 0 OR timers + .1 < TIMER
regs.ax = 2: CALL interrupt(&H33, regs, regs)

SELECT CASE cmd$
 CASE CHR$(0) + "H"
  IF mey% > 0 THEN mey% = mey% - 1
 CASE CHR$(0) + "P"
  IF mey% < 4 THEN mey% = mey% + 1
 CASE CHR$(18)'ctrl+r
  PreQ$ = ""
  Punct$ = ""
  totalq% = 1
  qnum% = 0
  REDIM Answer$(1)
  REDIM Questions$(1)
  Save
 CASE "+"
  Save
  IF Questions$(qnum% + 1) = "" OR Answer$(qnum% + 1) = "" THEN qnum% = qnum% - 1
  qnum% = qnum% + 1
  IF qnum% = totalq% THEN reget qnum% + 1, totalq%: totalq% = qnum% + 1
 CASE "-"
  IF qnum% > 0 THEN qnum% = qnum% - 1
 CASE CHR$(13)
  GOTO 30
 CASE CHR$(27)
  EXIT SUB
 CASE CHR$(19)'ctrl+s
  GOTO 60
END SELECT
GOTO 10

30 SELECT CASE mey%
 CASE 0
  number% = VAL(inputs$(3, 1))
  IF number% > 500 THEN number% = 500
  IF number% > totalq% THEN reget number%, totalq%: totalq% = number%
  IF number% > 0 THEN qnum% = number% - 1
 CASE 1
  P$ = inputs$(500, 0)
  IF P$ <> "" THEN PreQ$ = P$
 CASE 2
  Q$ = inputs$(500, 0)
  IF Q$ <> "" THEN Questions$(qnum% + 1) = Q$
 CASE 3
  P$ = inputs$(500, 0)
  IF P$ <> "" THEN Punct$ = P$
 CASE 4
  A$ = inputs$(500, 0)
  IF A$ <> "" THEN Answer$(qnum% + 1) = A$
END SELECT
Save
GOTO 10

60 Save

END SUB

FUNCTION inputs$ (max%, numtogl%)
COLOR 3, 6
LOCATE 11, 26
PRINT " ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ "
LOCATE , 26
PRINT " ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "
LOCATE , 26
PRINT " ßßßßßßßßßßßßßßßßßßßßßßßßß "
50 COLOR 14, 3
LOCATE 12, 27
PRINT RIGHT$(text$, 23);
COLOR 30
PRINT "Û "
DO
cmd$ = INKEY$
LOOP UNTIL cmd$ <> ""
SELECT CASE cmd$
 CASE IS > CHR$(31)
  IF numtogl% = 1 AND (cmd$ < CHR$(48) OR cmd$ > CHR$(57)) THEN cmd$ = ""
  IF LEN(text$) < max% THEN text$ = text$ + cmd$
 CASE IS = CHR$(13)
  inputs$ = RTRIM$(text$)
  EXIT FUNCTION
 CASE IS = CHR$(27)
  EXIT FUNCTION
 CASE IS = CHR$(8)
  IF LEN(text$) > 0 THEN text$ = LEFT$(text$, LEN(text$) - 1)
END SELECT
GOTO 50
END FUNCTION

SUB Install
COLOR , 0: CLS
COLOR 7, 1
PRINT STRING$(37, " "); "Install"; STRING$(36, " ")
COLOR 10, 0
PRINT "This doesn't seem to be installed yet.  Do you want to install This to the "
PRINT "current directory?  If This isn't already installed, you may need to move it"
PRINT "to the directory that contains the MYDATA25.6~~ subdirectory, or change the "
PRINT "shortcut settings in the .PIF file if you are using it to load This."
COLOR 9
SHELL "cd>temp.tmp"
OPEN "temp.tmp" FOR INPUT AS #1
 INPUT #1, cd$
CLOSE #1
KILL "temp.tmp"
PRINT : PRINT "English:"
COLOR 10
PRINT "This doesn't seem to be on your computer yet.  Do you want to install This to"
PRINT CHR$(34); RIGHT$(cd$, 75); CHR$(34); "?"
PRINT "If This is already on your computer, it's messing up a little.  There should "
PRINT "be a folder called MYDATA25.6~~ somewhere on your computer.  Find that, and "
PRINT "move This to the folder that has MYDATA25.6~~ in it.  If it already is, delete"
PRINT "the shortcut to This, and then make a new shortcut to This."

COLOR 15: PRINT
PRINT "Do you want to install This?  Press ";
COLOR 11
PRINT "Y ";
COLOR 15
PRINT "or";
COLOR 11
PRINT " N";
COLOR 15
PRINT "."
DO
cmd$ = UCASE$(INKEY$)
LOOP UNTIL cmd$ = "N" OR cmd$ = "Y" OR cmd$ = CHR$(27)
IF cmd$ = "N" OR cmd$ = CHR$(27) THEN END

MKDIR "MYDATA25.6~~"
IF eoccur% > 0 AND eoccur% <> 75 THEN COLOR 13: PRINT "Error:"; eoccur%: eoccur% = 0
OPEN "MYDATA25.6~~\study.txt" FOR OUTPUT AS #1
 PRINT #1, "Number of Questions:"
 PRINT #1, "19"
 PRINT #1, "PreQuestion:"
 PRINT #1, "What is the French word "; CHR$(34)
 PRINT #1, "Punctuation:"
 PRINT #1, CHR$(34); " translated into English?"
 PRINT #1, "Questions and Answers:"
 FOR i% = 1 TO 19
  READ Q$, A$
  PRINT #1, Q$
  PRINT #1, A$
 NEXT i%
CLOSE #1
COLOR 12, 0: CLS
LOCATE 10, 4
PRINT "Close this program and then open it again to complete the installation."
timers = TIMER
DO: LOOP UNTIL timers + 1 < TIMER
END
END SUB

SUB LoadProg
SCREEN 0
WIDTH 80
CLS
COLOR 7, 1
PRINT STRING$(35, " "); "Loading..."; STRING$(35, " ")
COLOR 14, 0
PRINT CHR$(9); "Find DATA directory"
PRINT CHR$(9); "Detect Mouse"
PRINT CHR$(9); "Check to see if This is installed"
PRINT CHR$(9); "Start Program"
LOCATE 2, 70
COLOR 6
PRINT "ù"
LOCATE , 70: PRINT "ù"
LOCATE , 70: PRINT "ù"
LOCATE , 70: PRINT "ù"
'find DATA directory:
COLOR 30
LOCATE 2, 70: PRINT "®"
CHDIR "MYDATA25.6~~"
IF eoccur% = 76 THEN
 LOCATE 2, 70
 COLOR 12
 PRINT "î"
 noinstalled% = -1
ELSE
 CHDIR ".."
 COLOR 11
 LOCATE 2, 70: PRINT "û"
END IF
eoccur% = 0

'detect mouse:
COLOR 30
LOCATE 3, 70
PRINT "®"
regs.ax = 0
CALL interrupt(&H33, regs, regs)
IF regs.ax THEN minst% = -1
IF minst% THEN
 LOCATE 3, 70
 COLOR 11
 PRINT "û"
ELSE
 LOCATE 3, 70
 COLOR 12
 PRINT "î"
END IF

'check to see if This is installed:
COLOR 30
LOCATE 4, 70
PRINT "®"
IF noinstalled% THEN
 SHELL "cd >temp.tmp"
 OPEN "temp.tmp" FOR INPUT AS #1
  INPUT #1, cd$
 CLOSE #1
 KILL "temp.tmp": cd$ = LEFT$(cd$, 3)
 SHELL "dir " + cd$ + "MYDATA25.6~~/s/b/ad>temp.tmp"
 OPEN "temp.tmp" FOR INPUT AS #1
  IF LOF(1) > 0 THEN INPUT #1, cd$: CHDIR cd$:  ELSE CLOSE #1: Install
 CLOSE #1
 KILL "temp.tmp": CHDIR cd$
END IF
LOCATE 4, 70
COLOR 11
PRINT "û"

'start program:
LOCATE 5, 70
COLOR 30
PRINT "®"
END SUB

SUB reget (numbers%, op%)
OPEN "MYDATA25.6~~\study.txt" FOR INPUT AS #1
 LINE INPUT #1, null$
 LINE INPUT #1, t$
 totalq% = VAL(t$)
 LINE INPUT #1, null$
 LINE INPUT #1, PreQ$
 LINE INPUT #1, null$
 LINE INPUT #1, Punct$
 IF numbers% = 0 THEN numbers% = totalq%
 REDIM Answer$(numbers%)
 REDIM Questions$(numbers%)
 LINE INPUT #1, null$
 IF op% = 0 THEN op% = totalq%
 FOR i% = 1 TO op%
  LINE INPUT #1, Questions$(i%)
  LINE INPUT #1, Answer$(i%)
 NEXT i%
CLOSE #1
END SUB

SUB Save
OPEN "MYDATA25.6~~\study.txt" FOR OUTPUT AS #1
 PRINT #1, "Number of Questions:"
 PRINT #1, totalq%
 PRINT #1, "PreQuestion:"
 PRINT #1, PreQ$
 PRINT #1, "Punctuation:"
 PRINT #1, Punct$
 PRINT #1, "Questions and Answers:"
 FOR i% = 1 TO totalq%
  PRINT #1, Questions$(i%)
  PRINT #1, Answer$(i%)
 NEXT i%
CLOSE #1
END SUB

 
 Respond to this message   
Response TitleAuthorDate
 *May crash in windows XP Sep 6, 2005