Computer Science Canada [RESUEST HELP]: How to run a turing program from a turing program? |
Author: | renaissance [ Wed Jan 23, 2008 9:07 pm ] |
Post subject: | [RESUEST HELP]: How to run a turing program from a turing program? |
How would I run a turing program from a turing program? Anyone know? Thanks, renaissance. |
Author: | ericfourfour [ Wed Jan 23, 2008 9:23 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
You can compile one and run it using Sys.Exec. Really, you should not have to run a Turing program from another one. Try to combine both source files into one. There is always the include command that can help you with this. |
Author: | Clayton [ Wed Jan 23, 2008 9:23 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
You'll have to compile the program that you want to run, and then do some Sys.Exec() shenanigans to accomplish what you want to do. |
Author: | renaissance [ Wed Jan 23, 2008 10:17 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
Also...I've a question. How would I error trap a user to entering a 10 digit phone number? Here's my code so far: put "Enter phone number (10 digits and numbers only)." loop flag := false loop get phoneNum : * for decreasing i : length (phoneNum) .. 1 pattern:=index (nums, phoneNum (i)) if pattern>=1 then flag := true end if end for exit when flag=true put "Enter a valid phone number (10 digits and numbers only)." end loop exit when length (phoneNum) = 10 put "Enter a valid phone number (10 digits and numbers only)." end loop Does not quite work yet though :i... nums:="1234567890" Thanks, renaissance |
Author: | syntax_error [ Wed Jan 23, 2008 10:34 pm ] |
Post subject: | Re: [RESUEST HELP]: How to run a turing program from a turing program? |
first please use code tags next time but as for your question in turing isnt there a syntax length(?) jsut look in the help and then check if the length of the string is == to 10 if yes then use strint to make it a int if you need to use it as a int... |
Author: | renaissance [ Wed Jan 23, 2008 10:54 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
Okay... so...would this work? I ask for the phone number AS AN INT...make sure it is 10 digits...if it is...then I'll use the intstr command? Would that work? Syntax intstr ( i : int [ , width : int [ , base : int ] ] ) : string Their examples don't really help much. What I want accomplished in the end is: User enters a number..like "5192223333" as a integer. Then using the instr command, it'll convert it to a string as still "5192223333"? Thanks, renaissance. |
Author: | Nick [ Wed Jan 23, 2008 10:58 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
for converting from int to string use strint instead |
Author: | renaissance [ Wed Jan 23, 2008 11:03 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
I'm so lost here...so if I were to use strint...could anyone show me an example of it in use? Thanks, renaissance. |
Author: | Gooie [ Wed Jan 23, 2008 11:17 pm ] | ||
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? | ||
Just place the variable in the parameter of 'strint'.
That will draw the text "40". Of course 40 can be replaced with a variable. |
Author: | renaissance [ Wed Jan 23, 2008 11:30 pm ] | ||
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? | ||
Blah...I don't understand this strint command so I won't use it. So...back to sq. 1.
Any tips on making this ensure that the phone numbered entered is numbers? nums:="1234567890" |
Author: | Clayton [ Wed Jan 23, 2008 11:32 pm ] |
Post subject: | RE:[RESUEST HELP]: How to run a turing program from a turing program? |
use strintok() |