Home

Our Software | Documentation | Registration | Contact Us
GuineaSOFT
GuineaQUIZ Lite 1.0 for SmallBASIC Source Code

 

' GuineaQuiz Lite 1.0
' by GuineaSOFT
' (c) Copyright 2002
' All Rights Reserved
 
declare sub sout &
 (color_int, textstring)
declare sub selectquiz() 
declare sub loadquiz()
declare func getyn()
declare func rightwrong()
declare sub tapcont()
declare sub tapans()
declare sub askques()
declare sub wout(textstring)
 
const  version = "1.0"
const gotright=true
const gotwrong=false
 
dim ques(1 to 100)
dim ans(1 to 100)
 
SUB tapans
local inp
let inp=""
pen on
rect 1, 135, 159, 159, color 1 &
 filled
at 48,142
color 15, 1
print "Tap for answer";
repeat
while not pen(0)
wend
until pen(1)>1 and &
 pen(1) < 152 and &
 pen(2)>135 and &
 pen(2)<159
color 0,15
end
 
SUB tapcont
local inp
let inp=""
pen on
rect 1, 135, 159, 159, color 1 &
 filled
at 48,142
color 15, 1
print "Tap to Continue";
repeat
while not pen(0)
wend
until pen(1)>1 and &
 pen(1) < 152 and &
 pen(2)>135 and &
 pen(2)<159
color 0,15
end
 
FUNC rightwrong
local inp
let inp=""
pen on
rect 1, 135, 77, 159, color 2 &
 filled
rect 79, 135, 162, 159, color 4 &
 filled
at 30,142
color 15, 2
print "RIGHT";
at 104,142
color 15,4
print "WRONG";
color 0,15
while not pen(0)
wend
if pen(1)>1 and &
 pen(1) < 79 and &
 pen(2)>135 and &
 pen(2)<159
let rightwrong=true
elseif pen(1)>79 and &
 pen(1)<159 and &
 pen(2)>135 and &
 pen(2)<159
let rightwrong=false
endif
end
 
SUB wout(textstring)
local wraplen
local stringarray()
local newstring
local LoopA
let wraplen=30
let newstring=""
split textstring, " ", stringarray()
for loopA=0 to &
 ubound(stringarray)
if len(newstring)+ &
 len(stringarray(loopA)) &
 <= wraplen
let newstring=newstring + &
 " " + stringarray(loopA)
else
print newstring
let newstring=""
let newstring= &
 stringarray(loopA)
endif
next loopA
print newstring
end
 
FUNC getyn
local inp
let inp=""
pen on
rect 1, 135, 77, 159, color 2 &
 filled
rect 79, 135, 162, 159, color 4 &
 filled
at 33,142
color 15, 2
print "Yes";
at 113,142
color 15,4
print "No";
color 0,15
while not pen(0)
wend
if pen(1)>1 and &
 pen(1) < 79 and &
 pen(2)>135 and &
 pen(2)<159
let getyn=true
elseif pen(1)>79 and &
 pen(1)<159 and &
 pen(2)>135 and &
 pen(2)<159
let getyn=false
endif
end
cls
print "GuineaQUIZ Lite"
print  "-------------------": print
print  "Select the memo " &
 + "containing the quiz: ":print
 mfn_array()= &
 files("MEMO:*")
for  LoopA = 0 to &
 ubound(mfn_array)
print  "  "; LoopA+1; "."; &
 mfn_array(LoopA)
next
print
print  "Memo number";
input  mnum
 quizfile = &
 mfn_array(mnum-1)
print
cls
print  "You selected: "; quizfile
end
 
SUB loadquiz()
open "MEMO:"+quizfile &
 for input as #1
let numques=0
let numans=0
while not eof(1)
lineinput #1, txt
if ucase(left(txt,2))="Q="
let numques++
let ques(numques)= &
 trim(replace(txt,1,"  "))
elseif ucase(left(txt,2))="A="
let numans++
let ans(numans)= &
 trim(replace(txt,1,"  "))
endif
wend
close #1
print "Number of questions: "; &
 numques
tapcont
end
 
SUB  askques
local loopA
local numright
local numwrong
let quesrem=numques
for loopA=1 to numques
cls
wout ques(loopA)
tapans
cls
wout ans(loopA)
if rightwrong=gotright
let numright++
else
let numwrong++
endif
cls
next
cls
print "Quiz Complete.":print
print "Questions correct    : "; &
 numright
print "Questions incorrect : "; &
 numwrong
print
end
 
#MAIN
cls
at 35, 70
let exiting=false
while not exiting
selectquiz
loadquiz
askques
print "Would you like to load " + &
 "another quiz? "
if  getyn=no
let exiting=true
else
cls
endif
wend
end


Questions?  Comments?  Suggestions?  Feel free to contact us at: