Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [RESUEST HELP]: How to run a turing program from a turing program?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
renaissance




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: 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.
Clayton




PostPosted: 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.
renaissance




PostPosted: 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
syntax_error




PostPosted: 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...
renaissance




PostPosted: 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.
Nick




PostPosted: 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
renaissance




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Gooie




PostPosted: 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'.
code:

Draw.Text (strint (40), 100, 100, font)


That will draw the text "40". Of course 40 can be replaced with a variable.
renaissance




PostPosted: 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.

code:

put "Enter phone number (10 digits and numbers only)."

            loop
                flag := true

                loop
                    get phoneNum : *
                    for decreasing i : length (phoneNum) .. 1

                        pattern:=index (phoneNum(i), nums)
                        if pattern>=1 then
                            flag := false
                        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


Any tips on making this ensure that the phone numbered entered is numbers?

nums:="1234567890"
Clayton




PostPosted: Wed Jan 23, 2008 11:32 pm   Post subject: RE:[RESUEST HELP]: How to run a turing program from a turing program?

use strintok()
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: