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

Username:   Password: 
 RegisterRegister   
 i made a selecting program for hockey but i messed up the loop part and i need help fixing it
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
h_g123




PostPosted: Sun Jan 06, 2008 8:27 pm   Post subject: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

so this is what i have so far
Declare variables
var answer: string
var command:int
var x:int
var y:int
var x1:int
var y1:int
var x2:int
var y2:int
Draw.Dot (80,70,blue)
var font1:int
font1 := Font.New ("Harrington:14:bold,italic")


loop


Font.Draw ("What's your favorite hockey team?", 160, 250, font1, brightblue)
locate (12,11)
put "Choose the number for your favorite hockey team from below:"
locate (13,1)
put "1-The Maple Leafs"
put "2-The senaters"
put "3-The Fames"
put "4- a different team"
put "5- the world junior canadian guys team"
put "6- i don't wanna to answer this question and i want to exit"
get command

case command of
label 1 : put "You picked one of the best teams GO LEAFS GO!!!"
label 2 : put "The senators huh well not a bad team but you are a traiter!"
label 3 : put "Better then being a senators fan, at least you picked a canadian team..."
label 4 : put "Not bad as long as it's not an american team...if it is wow you suck!!!"
label 5 : put "You picked a winning team, after all they just won a gold medal!!!"
label 6 : exit
label : put "I don't understand which team you picked"
end case

loop
Font.Draw ("Would you like to continue (y/n) ???", 152, 250, font1, blue)
color(blue)

get answer
cls
exit when answer="n"

end loop




put "LEAFS RULE, GO for the real canadian team or the world junior team!!!"
Draw.MapleLeaf (220,250,270,290,blue)
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Sun Jan 06, 2008 10:42 pm   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Add an end loop at the end...

Here's a tip...Use the ident button at the top. Not only will it sort your code, but if the last line is indented, that meen you forgot to close a loop/function etc.

You also might wanta consider clearing the screen after a few things.
h_g123




PostPosted: Mon Jan 07, 2008 12:04 am   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

[quote="Zren @ Sun Jan 06, 2008 10:42 pm"]Add an end loop at the end...

Here's a tip...Use the ident button at the top. Not only will it sort your code, but if the last line is indented, that meen you forgot to close a loop/function etc.

thanks that really did make it clearer
Gackt




PostPosted: Mon Jan 07, 2008 10:21 am   Post subject: RE:i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Heres your problem...

label 1 : put "You picked one of the best teams GO LEAFS GO!!!"


Thats all wrong. It should be.

label 1 : put "You picked the Worst teams Boo LEAFS!!!!

:p
h_g123




PostPosted: Mon Jan 07, 2008 1:21 pm   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

what ever
you know you love the leafs......=p
who couldn;t love that team
Gackt




PostPosted: Mon Jan 07, 2008 2:29 pm   Post subject: RE:i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Red Wings Pwn them so bad
Clayton




PostPosted: Mon Jan 07, 2008 3:58 pm   Post subject: RE:i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Let's get back on topic here, or I'm afraid I'll have to lock this thread.
Sean




PostPosted: Mon Jan 07, 2008 7:52 pm   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Turing:

var x : int
var y : int
var x1 : int
var y1 : int
var x2 : int
var y2 : int


You declared these variables, and did not use them once in your program and are un-needed, I suggest you read over your program and delete any un-needed variables. The Dot is also not required as it has no purpose in the program, and as we will all suggest, indenting is key, press F2 to do so.

Turing:

Font.Draw ("What's your favorite hockey team?", 160, 250, font1, brightblue)
    locate (12, 11)
    put "Choose the number for your favorite hockey team from below:"
    locate (13, 1)
    put "1-The Maple Leafs"
    put "2-The senaters"
    put "3-The Fames"
    put "4- a different team"
    put "5- the world junior canadian guys team"
    put "6- i don't wanna to answer this question and i want to exit"
    get command


Also another suggestion, read over your work and spell everything correctly, Capitals like you used in the Maple Leafs should be used through out the entire program, not just once.

Also, Your user repsonse doesn't work properly, make sure it erases screen and reloads.
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Mon Jan 07, 2008 8:52 pm   Post subject: RE:i made a selecting program for hockey but i messed up the loop part and i need help fixing it

When you paste without syntax/code tags, it removes indentation. It might have been indented.
h_g123




PostPosted: Wed Jan 09, 2008 1:42 pm   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

thanks guy i got it working and your suggetions were all helpful.... Very Happy
Sean




PostPosted: Wed Jan 09, 2008 3:16 pm   Post subject: Re: i made a selecting program for hockey but i messed up the loop part and i need help fixing it

Your welcome, any other questions regarding this project, feel free to ask.
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  [ 11 Posts ]
Jump to:   


Style:  
Search: