Computer Science Canada Impossible Program |
Author: | Fozmik [ Sat Nov 11, 2006 8:22 pm ] | ||
Post subject: | Impossible Program | ||
This program determines change for a twenty dollar bill. The cost is determined by the user. At the end of the program the user has a choice to either end the program or to start over. I decided to try something different and use Input.Keydown rather than a get. The program wasn't waiting for input so i put the Input.Keydown into a loop, which is nested in several other loops that are needed by the whole program. When the user presses the 'n' key, all the loops are ended and the window is closed. The program is supposed to loop from the beginning when the 'y' key is pressed, but so far this seem impossible because no matter what the loop that is covering the entire program is being ended. Basically, I think a solution to this would be to skip the line that is ending the loop when the user presses 'y'. Ive checked the Tutorials and read through Turing's help and so far all I've found is that Turing does not have a Goto function to do this. Maybe I could make the program restart when the 'y' key is pressed?
|
Author: | shoobyman [ Sat Nov 11, 2006 8:55 pm ] | ||
Post subject: | |||
try that instead, it will completely close the program if you press no, or it will start again if you press yes. Just fix it cuz it won't display the purpose of the program when you say yes |
Author: | Fozmik [ Sat Nov 11, 2006 10:19 pm ] |
Post subject: | |
That works great except I get a runtime error when I run it as an .exe |
Author: | Tony [ Sat Nov 11, 2006 10:46 pm ] |
Post subject: | |
that does not sound right.. but then again you provided no details in that statements (what's the error? what version of Turing have you used? any special compile options?) |
Author: | Clayton [ Sat Nov 11, 2006 10:50 pm ] | ||
Post subject: | |||
thats because quit simply generates an error to quit the program, instead have some sort of boolean to exit both loops ie:
|
Author: | Fozmik [ Sat Nov 11, 2006 11:04 pm ] |
Post subject: | |
That fixes it, thanks alot |