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

Username:   Password: 
 RegisterRegister   
 Help With Turing Trivia Game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
powerful08




PostPosted: Mon Jan 17, 2011 5:50 pm   Post subject: Help With Turing Trivia Game

What is it you are trying to achieve?
Im Trying To Achieve A Trivia Game In Turing with 50-50s( Split) without using the procedure function since the rest of my class isnt allowed to use it


What is the problem you are having?
Every time put it krypton as my answer for the first question turing ends the programs afters it displays what i want it to and since Krypton is the answer for the first one i dont know what to do


Describe what you have tried to solve this problem
i have tried to write it down logically but i still cant do it


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:

% Sabariesan's Beta Program Of Trivia
% Note The Split Only Works for The First Question
% Half Way Done
% Need More Questions And Put In The Split, Walk Away and the Ask The Audience Feature Which Will Be Included In The Final Edition
var name : string
var answer1 : string
var score : int
var answer : string
var key : string (1)
var answer2 : string
var answer3 : string
var Split : int := 1

put "Hello Are You Ready To Play The Greatest Comic Book, Sports, Movie"
put "Anime, And Technology Game Ever Made Then Input Your Name If You Dare"

get name
cls


put "Ok Here Are The Rules If You Answer A Question Right You Will Get Points"
put "The Number Of Points Will Depend On The Difficulity Of The Question"
put "If You Get 1 Question Wrong The Computer Will Self-Destruct"
put "If You Understand Press Any Button To Continue"
put "If You Get Stuck At Any Of The Questions You Can Get Rid Of Two"
put "Answers By Inputing the Word Split Exactly Like How I Just Spelt It"
put "But Remember You Can Only Use The Split Once"

getch (key)
cls

put "Ok " ..
put name, " For $100 Dollars What Is The Name Of Supermans Home Planet?"
put "1) Krypton"
put "2) Pluto"
put "3) Kryptonia"
put "4) Earth"

put "Please Input Your Choice"
get answer1
cls


if answer1 = "1" then
    score := +100
    put "Congrats You Got This Question Right So Far You Have Won " ..
    put score ..
    put " Dollars"

elsif answer1 = "Split"


        then

    cls
    put " Remember You Have Used Your Only Split You Can Not Use The Split For The Rest  Of The Game"
    put " 1) Krypton"
    put " 2) Earth"
    get answer1
    if answer1 = "1" then
        score := +100
        put "Congrats You Got This Question Right So Far You Have Won " ..
        put score ..
        put " Dollars"
        getch (key)
        cls

    elsif answer1 = "2" or answer1 = "3" or answer1 = "4"

            then
        put " I'm Sorry But That is Incorrect This Computer Will Now Self Destruct"
   

    put " Question 2 For $150 Dollars What Does The Acronym R.A.M Stand For"

    put " 1) Restarting Access Memory"
    put " 2) Recent Activation Medical"
    put " 3) Royal Arch Masonry"
    put " 4) Random Access Memory"

    get answer

    if answer = "4" then
        score := +250
        cls

        put "Congrats You Got This Question Right So Far You Have Won " ..
        put score ..
        put " Dollars"
        getch (key)

    elsif answer = "1" or answer = "2" or answer = "3"
            then
        put " I'm Sorry But That is Incorrect This Computer Will Now Self Destruct"
    end if

elsif answer = "Split"
        then
    put "OK You Have Used Your One And Only Split"
    put "1) Restarting Access Memory"
    put "2) Random Access Memory"
    get answer
    if answer = "1" then
        put " Congrats You Got This Question Right So Far You Have Won $ 250 "


        getch (key)

        cls

        put name, " Your Next Question Is About Sports And Its Worth $200 Dollars  "

        put "In What Major League Sport Does A City Represent A Entire Country"
        put "1) Canadian Football League And The USA"
        put "2) National Basketball Association And Canada"
        put "3) National Hockey League And Sweeden"
        put "4) Major League Baseball And Mexico"

        get answer2

        if answer2 = "2" then
            score := +450
            cls
            put "Congrats You Got This Question Right So Far You Have Won " ..
            put score ..
            put " Dollars"
            getch (key)
            cls

        elsif answer2 not= "2" then
            put " I'm Sorry But That is Incorrect This Computer Will Now Self Destruct"

        end if
    end if
end if
end if



Please specify what version of Turing you are using
Turing 4.11
Sponsor
Sponsor
Sponsor
sponsor
lordroba




PostPosted: Mon Jan 17, 2011 6:38 pm   Post subject: Re: Help With Turing Trivia Game

look at the order of your 'if' statements. You only display question 2 if you got question 1 wrong.

elsif answer1 = "2" or answer1 = "3" or answer1 = "4" %question is wrong

then
put " I'm Sorry But That is Incorrect This Computer Will Now Self Destruct"


put " Question 2 For $150 Dollars What Does The Acronym R.A.M Stand For" %display question 2

change where you have the question displayed. Display question 2 when you get question 1 right, not when you get it wrong Very Happy
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  [ 2 Posts ]
Jump to:   


Style:  
Search: