
-----------------------------------
recyclebin123
Wed Mar 23, 2005 11:28 pm

need help with assigment
-----------------------------------
umm for my comp sci class i need to make a quiz thing that will ask the user for the capital of a province in canada and he will get 3 trys before moving on and if he or she gets it right the first time he gets 3 points and second guess he gets 2 points and 3rd guess he gets 1 point. Unfortunately i do not know how to do this. This is all i got so far.........

var tor, quecity, vict, edm, reg, winni, stj, fred, hali : string
        var count : int := 0
        put "Please answer with capital letters for first letter"
        put "You get THREE trys for each question"
        put ""
        put ""
        put "What is the capital of Ontario"
        loop
            count := count + 1
            get tor
            if tor = "Toronto" then
                put "You are correct"
            else
                put "You are wrong. Please Try again"
            end if
            exit when count = 3 or tor = "Toronto"
        end loop

        put ""
        put ""
        put "What is the captial of Quebec"
         loop
            count := count+1
            get quecity
            if quecity = "Quebec City" then
                put "You are correct"
            else
                put "Nope sorry. Youre Wrong"
                end if
            exit when count = 6 or quecity = "Quebec City"
        end loop


This sort of works but i dun no how to do the points part and how to end it if the user were to get it rite on the second try or first.

-----------------------------------
Naveg
Wed Mar 23, 2005 11:34 pm


-----------------------------------
var points:int
if count=1 then
points:=3      %3 points if on first try
elsif count=2 then
points:=2
elsif count=3 then
points:=1
end if


-----------------------------------
zylum
Thu Mar 24, 2005 12:50 am


-----------------------------------
like this?

var guess : string
var count : int := 0
put "Please answer with capital letters for first letter"
put "You get THREE trys for each question\n\n"

put "What is the capital of Ontario?"
for i : 0 .. 2
    get guess : *
    if guess = "Toronto" then
        put "yup!"
        count += 3 - i
        exit
    end if
    put "\nnope, try again"
end for

put "\nWhat is the capital of Quebec?"
for i : 0 .. 2
    get guess : *
    if guess = "Quebec City" then
        put "yup!"
        count += 3 - i
        exit
    end if
    put "\nnope, try again"
end for

put "\nyour score is ", count

-----------------------------------
Mr. T
Thu Mar 24, 2005 12:50 am


-----------------------------------

get quecity 
if quecity = "Quebec City" then 


Since Quebec City is a string with two words, you need to make your get statement compatible.


get quecity :*
if quecity = "Quebec City" then 


Good Luck.
