Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Points System
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Milan




PostPosted: Sun Jan 21, 2007 3:07 pm   Post subject: Points System

I created a Trivia program for my ISU that's due on Tuesday, I know it looks pretty easy to make.

At the end after you answer the third quesiton it just keeps looping the second question and doesn't distribute the points properly.

The answer key is A,C,B. To make it easier to help me with my problem.

Thanks.



ISU.t
 Description:

Download
 Filename:  ISU.t
 Filesize:  2.5 KB
 Downloaded:  94 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
agnivohneb




PostPosted: Sun Jan 21, 2007 4:36 pm   Post subject: Re: Points System

I have fixed it I don't know why you had a for loop there.

This way only goes through the questions once.

I also made it shorter.

Don't hand in this exact copy. Edit it abit, add more questions using the same formate.

code:
var ans : string (1)
var name : string
var score : int := 0

put "Welcome To Milan's Trivia Program"
delay (1000)
put "You Will Be Asked a series of questions and depending on how many you get right"
delay (1000)
put "you will earn a certain amount of money."
delay (1000)
put "The maximum amount of money which you can earn is $10"
delay (1000)
put "Good Luck To the Participant"
delay (1000)
put "Please Enter Your Name : " ..
get name
delay (1000)
put "Please press the Any key to start the Game, ", name
Input.Pause
cls

put "Who won the Stanley Cup in 2006?"
put "A) The Carolina Hurricanes"
put "B) The Edmonton Oilers"
put "C) The Colorado Avalanche"
getch (ans)
cls
if ans = "a" or ans = "A" then
    put "You are correct."
    score += 1
else
    put "You are Incorrect."
end if
put "You have $", score
put "Push Any Key to continue, ", name
Input.Pause
cls


put "Who was the original lead singer of the band Pink Floyd?"
put "A) Roger Waters"
put "B) David Gilmour"
put "C) Syd Barrett"
getch (ans)
cls
if ans = "c" or ans = "C" then
    put "You are correct."
    score += 1
else
    put "You are Incorrect."
end if
put "You have $", score
put "Push Any Key to continue, ", name
Input.Pause
cls


put "Who won Superbowl I?"
put "A) The Kansas City Chiefs"
put "B) The Green Bay Packers"
put "C) The Baltimore Colts"
getch (ans)
cls
if ans = "b" or ans = "B" then
    put "You are correct."
    score += 1
else
    put "You are Incorrect."
end if
put "You have $", score
put "Push Any Key to continue, ", name
Input.Pause
cls
Milan




PostPosted: Sun Jan 21, 2007 5:43 pm   Post subject: Re: Points System

Thanks a lot man.
agnivohneb




PostPosted: Sun Jan 21, 2007 6:06 pm   Post subject: RE:Points System

You welcome hope you do well.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: