Computer Science Canada Unknown Error - please dont delete, i cant explain the prob |
Author: | TokenHerbz [ Mon Jul 18, 2005 12:24 am ] |
Post subject: | Unknown Error - please dont delete, i cant explain the prob |
var num1: int var num2: int var answer: int var ans1: string var ans2: string var ans3: string var factor: string put "Please enter a number." get num1 %Gets your 1st number put "are you sure you wish to use this number? ('yes' or 'no')" get ans1 if ans1= "yes" then put "Exelent" else put "please re-select a number." get num1 end if put "Please enter a number." get num2 %Gets your 2nd number put "are you sure you wish to use this number? ('yes' or 'no')" get ans2 if ans2= "yes" then put "Exelent" else put "please re-select a number." get num2 end if %Gets your factor. put "Please enter in a math equation factor, *, -, /, +." get factor put "Are you sure you want to use this factor? ('yes' or 'no'" if ans3= "yes" then put "Exelent" else put "Please enter in a new factor" get factor end if %Gets the answer. if factor= "*" then answer := num1 * num2 put num1, " * ", num2, " = ", answer put "thanks for your time" elsif factor= "/" then answer := num1 / num2 <<<<<<<-----------THE ERROR!!!! put num1, " / ", num2, " = ", answer put "thanks for your time" elsif factor= "-" then answer := num1 - num2 put num1, " - ", num2, " = ", answer put "thanks for your time" elsif factor= "+" then answer := num1 + num2 put num1, " + ", num2, " = ", answer put "thanks for your time" end if |
Author: | TokenHerbz [ Mon Jul 18, 2005 1:08 am ] |
Post subject: | |
Also, i have another question... If i make a game, can other people without Turing play it? And thats about it, Oh one more... How do i make a super easy web site which is actually accessable, so i can put my games on, for others to try? or do they have to download it? must they need turing?? are there ways around it?? Thanks! |
Author: | TokenHerbz [ Mon Jul 18, 2005 1:42 am ] |
Post subject: | |
Um, also to the above.... Im trying to get a users input on 2 numbers, num1 and num2, and then i want the user to pick either * / - + , and then i want to do the equation with the users information.... Thanks! please help fast, i read posts with bad titles like mine get deleted!!! |
Author: | Tony [ Mon Jul 18, 2005 1:50 am ] | ||
Post subject: | |||
hey, welcome to the site ![]() first of all - use [ syntax="language" ]code here[ /syntax ] tags. In your case language is turing. I'm not sure what's the error is, I haven't tried it out. It might be that you're assigning a division result (a real value) to an integer. Ether way, you don't even need that "answer" variable.
Now to answer some of your other questions. >If i make a game, can other people without Turing play it? Yes, if you compile your program. >How do i make a super easy web site which is actually accessable, so i can put my games on, for others to try? We'll host your projects here ![]() |
Author: | Cervantes [ Mon Jul 18, 2005 7:28 am ] | ||||
Post subject: | |||||
Tony wrote: I'm not sure what's the error is, I haven't tried it out. It might be that you're assigning a division result (a real value) to an integer. Ether way, you don't even need that "answer" variable.
Verified. If you really want to store the answer into a variable, either make the variable real (not int) or use the round function, like this:
One final way is to use div (check the help file), but that's not as good as round beacause it will always round down. That is, 2.7 rounds down to 2. div is just easier to type. ![]() |
Author: | MysticVegeta [ Mon Jul 18, 2005 7:42 pm ] | ||
Post subject: | |||
Here is the same code in half the lines
|
Author: | TokenHerbz [ Tue Jul 19, 2005 1:29 pm ] |
Post subject: | |
i dont understand your code, Also can you explain how arrays work, and if i wanted to create a moving ball I find this interesting, but have no teacher... i want to make a snake game, how do i make graphics... i was just going to creat it pac man style... Anyways, your code, "put skip, "Please enter a number: " " whats skip do??? ive never seen this befor... |
Author: | Cervantes [ Tue Jul 19, 2005 1:57 pm ] |
Post subject: | |
For such a tremendous multitude of questions, there is only one answer. Check out the Turing Walkthrough. As for skip: open Turing; type "skip", press F9; read. It should be pretty understandable. tokenherbz wrote: I find this interesting, but have no teacher...
Compsci teachers don't usually do very much anyways. We do more. ![]() No offense meant, but creating a snake game is way beyond your current level. If you want, check out some source code to a snake game or two. There's probably lots of syntax you've never seen before, let alone understand. If you really want to make one though, work your way through the Turing Walkthrough. ![]() |
Author: | Delos [ Tue Jul 19, 2005 1:58 pm ] |
Post subject: | |
I would suggest you start by looking through the Tutorials section. Specifically, Cervantes Walkthrough. This will explain to you all the details of Mystic's code. For a start, while you have Turing open (this is called your IDE) press F10. A help screen should pop up. This contains all the commands and syntax in the Turing language (this is called an API). You can get a technial definition of them in here. Of course, you'll be better off in the Tutorials since they explain things from a practical and understandable point. |