Computer Science Canada Question in a question |
Author: | DVL_IAC [ Sat Feb 12, 2005 11:38 pm ] | ||
Post subject: | Question in a question | ||
How would i ask a 2 answer question (like y or n) then if they said y it brings another y or n question.... its hard to explain what i mean... ex:
how would i do that? ![]() ![]() |
Author: | Tony [ Sat Feb 12, 2005 11:48 pm ] |
Post subject: | |
you could build out if - elsif - else structure. |
Author: | 1337_brad [ Sun Feb 13, 2005 12:21 am ] |
Post subject: | You could also use processes |
you could use a process so that the music starts playing, and it starts to ask the user if he wants to change songs... [/code] |
Author: | DVL_IAC [ Sun Feb 13, 2005 10:32 pm ] | ||
Post subject: | |||
tony wrote: you could build out if - elsif - else structure.
i clicked the link and read and im confused. ![]() i put
and when the person puts n as the answer to the first question the program just stops and doesnt say "Fine Then! Be that way!" ![]() i'm guessing im not understanding the if - elsif - else thing right ![]() |
Author: | cycro1234 [ Mon Feb 14, 2005 8:26 am ] |
Post subject: | |
You could also try declaring each choice as a variable at the beginning of ur program. So like: var choice1, choice2, choice3 : string Then using each on individually in ur program. This way the program remembers what the value of choice1 is, and so on. |
Author: | Tony [ Mon Feb 14, 2005 10:31 am ] |
Post subject: | |
DVL_IAC wrote: i'm guessing im not understanding the if - elsif - else thing right
it understands it alright - computers don't make mistakes. You just wrote it down wrong ![]() Use F2 to indent your code and take a look at your structure closely. Try to follow it through in your head. |
Author: | DVL_IAC [ Mon Feb 14, 2005 5:30 pm ] | ||||
Post subject: | |||||
cycro1234 wrote: You could also try declaring each choice as a variable at the beginning of ur program. So like:
var choice1, choice2, choice3 : string Then using each on individually in ur program. This way the program remembers what the value of choice1 is, and so on. hmm like this
? or like this
? hmm both ways it still finishes the program when you put n as the answer to the first question. Tony wrote: Use F2 to indent your code and take a look at your structure closely. Try to follow it through in your head. I did and it seams fine to me... ![]() |
Author: | Bacchus [ Mon Feb 14, 2005 5:39 pm ] |
Post subject: | |
put one end if right after the if chioce2="n" then kk thing and remove one at the end right now ur checking to see if chioce1 in "n" in the check to see if chioce1="y" |
Author: | DVL_IAC [ Tue Feb 15, 2005 6:20 pm ] | ||
Post subject: | |||
ok i got it to continue when you push n on the first question.. ![]()
but when you answer n to the first question it goes on and asks you if you want to change the song which it only should do if you answer y to the first question... how can i get it so if u answer n to the first question it skips the do you want to change songs question and goes right to "Fine Then! Be that way!" ??? ![]() |
Author: | ssr [ Tue Feb 15, 2005 9:17 pm ] | ||||
Post subject: | |||||
use
![]()
put the ifs inside another if I think thats called nested ifs lol ![]() ![]() |
Author: | ssr [ Tue Feb 15, 2005 9:21 pm ] | ||
Post subject: | |||
There you go, a code, hopefully thats what u need ![]() ![]() |
Author: | ssr [ Tue Feb 15, 2005 9:23 pm ] | ||||
Post subject: | |||||
Or I know that people say
but I do suggest using it in a music file so u can get the input while the music is playing Check out the tutorial if u dont know what a
![]() ![]() Im sure there are better ways to do it. Good Luck With It ![]() ![]() |
Author: | DVL_IAC [ Tue Feb 15, 2005 10:18 pm ] | ||
Post subject: | |||
ssr wrote:
There you go, a code, hopefully thats what u need ![]() ![]() yay it worked! ![]() |
Author: | DVL_IAC [ Tue Feb 15, 2005 10:25 pm ] |
Post subject: | |
Now 1 more question and i think i should be good for a bit ![]() ![]() [edit] woah regular users can double post! ![]() ![]() ![]() |
Author: | ssr [ Wed Feb 16, 2005 12:20 pm ] | ||
Post subject: | |||
yes sure u can put the code in a
Quote: woah regular users can double post! in the forums i usually hang around at only staff and admins can double post. if regular users could double post the forums would get majorly spammed up
As for that yaya we all should be greatful for that lol ![]() ![]() |
Author: | Tony [ Wed Feb 16, 2005 1:11 pm ] |
Post subject: | |
DVL_IAC wrote: woah regular users can double post!
![]() ![]() ![]() If you intend to spam, you'll be in for a surprise ![]() |
Author: | DVL_IAC [ Wed Feb 16, 2005 8:53 pm ] | ||||
Post subject: | |||||
ssr wrote: yes sure u can
put the code in a
Hmm I can't figure out whats wrong
if i choose I for the first question then choose C or B for the second question it just finishes the program and doesnt do anything and if i choose P for the first question the program just finishes and doesnt bring up P's options... what am I doing wrong? ![]() ![]() |
Author: | ssr [ Wed Feb 16, 2005 8:56 pm ] |
Post subject: | |
I just looked at ur code and the problem is u for got to end if see teh indentations? the elsi fto get p is not in teh loop u wants it to be in. ![]() ![]() |
Author: | ssr [ Wed Feb 16, 2005 8:58 pm ] | ||
Post subject: | |||
made just a very small change c if u can find it and hope it helps
![]() ![]() |
Author: | Bacchus [ Wed Feb 16, 2005 9:15 pm ] |
Post subject: | |
ur back buttons still arnt working cause when you cxhoose them it enters a loop then just repeats in that loop never to end.... not what u want what you want to do is start the loop where you want it to go back to and put the end loop after all of that and since im guessing that whatever you do it will go back to the beginning just stil the whole chioce thing in a loop-end loop |
Author: | ssr [ Wed Feb 16, 2005 9:25 pm ] | ||||||||
Post subject: | |||||||||
yepyep didnt pay attention to that part here is a useable one I hope
You know when I say put it in a
![]() ![]() ![]() EDIT this is the code with a proper indentation
|
Author: | StarGateSG-1 [ Thu Feb 17, 2005 12:17 pm ] | ||
Post subject: | |||
I have done you 2 favors here is the program aswell as proper format for code ![]() ![]() ![]()
Good luck with it ![]() ![]() |
Author: | DVL_IAC [ Fri Feb 18, 2005 8:32 pm ] | ||||
Post subject: | |||||
ssr wrote:
i just had to move one of the end loops and it works fine ![]() StarGateSG-1 wrote: I have done you 2 favors here is the program aswell as proper format for code
![]() ![]() ![]()
Good luck with it ![]() ![]() thanks for the code but ssr already gave me a working code for the music program a page back.. i saved your code though ![]() ![]() Quote: % This is my version of your assignment % It is more professial and covers all the basic's you will % learn through the year BTW non of these things are assignments.. i just thought of things i wanna find out how to do in turing then made these little example programs where i would need to use them then i can refer back to them ![]() |
Author: | DVL_IAC [ Fri Feb 18, 2005 9:20 pm ] |
Post subject: | |
Yay I made my first possably useful program ![]() all it does is convert a us price to canadian or a canadian price to us and if u want it'll tell you what the tax would be on something thats the price u choose ![]() its a pretty cheap program but if u want to try it u can d/l it Here ![]() |
Author: | ssr [ Sat Feb 19, 2005 1:59 pm ] |
Post subject: | |
Its a nice program, but it would be better if the user can chaneg teh ratio of teh currency, since its always changing. ![]() ![]() gj |