Computer Science Canada How do you.. |
Author: | thomasb [ Mon Jan 24, 2011 3:40 pm ] |
Post subject: | How do you.. |
Use a sentinel value of "-1" to exit. |
Author: | ProgrammingFun [ Mon Jan 24, 2011 4:16 pm ] |
Post subject: | RE:How do you.. |
You do not need to create new threads... if input == -1 exit without doing anything else else do everything else that is the pseudocode.... |
Author: | thomasb [ Mon Jan 24, 2011 4:49 pm ] |
Post subject: | Re: RE:How do you.. |
ProgrammingFun @ Mon Jan 24, 2011 4:16 pm wrote: You do not need to create new threads...
if input == -1 exit without doing anything else else do everything else that is the pseudocode.... How would i put this in my program: put "Welcome to converter" var cent : int put "Please enter the length in centimetres" get cent put "the length in inches is " .. put cent * 2.54 |
Author: | Tony [ Mon Jan 24, 2011 4:52 pm ] |
Post subject: | RE:How do you.. |
Presumably the "do everything else" part will be your existing program. |
Author: | ProgrammingFun [ Mon Jan 24, 2011 5:05 pm ] | ||
Post subject: | Re: RE:How do you.. | ||
thomasb @ Mon Jan 24, 2011 4:49 pm wrote: How would i put this in my program:
put "Welcome to converter" var cent : int put "Please enter the length in centimetres" get cent put "the length in inches is " .. put cent * 2.54 Just as Tony said:
|
Author: | thomasb [ Mon Jan 24, 2011 5:32 pm ] |
Post subject: | RE:How do you.. |
so I have it working now, how can i make it only display then length when its above 0 when i enter -1 to end it still shows the length? loop put "Welcome to converter" var cent : int put "Please enter the length in centimetres" get cent put "the length in inches is " .. put cent * 2.54 if cent <= -1 then exit else end if end loop |
Author: | Tony [ Mon Jan 24, 2011 5:42 pm ] |
Post subject: | RE:How do you.. |
I think simply reading that code out loud to yourself will answer that question. |
Author: | thomasb [ Mon Jan 24, 2011 6:36 pm ] |
Post subject: | Re: RE:How do you.. |
Tony @ Mon Jan 24, 2011 5:42 pm wrote: I think simply reading that code out loud to yourself will answer that question.
ive got no idea.. seems fine to me but idk what i have to change |
Author: | ProgrammingFun [ Mon Jan 24, 2011 6:53 pm ] | ||
Post subject: | Re: RE:How do you.. | ||
Put the following right beside you code and you will see what you are doing wrong: ProgrammingFun @ Mon Jan 24, 2011 5:05 pm wrote:
|
Author: | thomasb [ Mon Jan 24, 2011 7:08 pm ] |
Post subject: | RE:How do you.. |
thank you I think i got it!!: put "Welcome to converter" loop var lengt : int put "Please input the length centimetres" get lengt if lengt <= -1 then exit else put "the length in inches is " .. put lengt * 2.54 end if end loop |
Author: | ProgrammingFun [ Mon Jan 24, 2011 7:15 pm ] |
Post subject: | Re: RE:How do you.. |
thomasb @ Mon Jan 24, 2011 7:08 pm wrote: thank you I think i got it!!:
Ur Welcome. ![]() ![]() |
Author: | Raknarg [ Thu Feb 17, 2011 8:47 pm ] |
Post subject: | RE:How do you.. |
One thing your going to need with programming: The order always matters. if its not doing stuff at the right time, you probs just have to move the statement elsewhere. |
Author: | huskiesgoaler34 [ Thu Feb 17, 2011 8:53 pm ] |
Post subject: | Re: How do you.. |
Your bang on raknarg. I also find that a lot of beginners tend to over think how to solve their problems. I had that problem but I am getting better at planning my programs, then completing then using pseudo code or flow charts. The more experience you have, the easier the algorithm solving will be. Besides, you won't have that many logic errors to deal with anymore. |