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

Username:   Password: 
 RegisterRegister   
 strint help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
beamer




PostPosted: Fri Nov 11, 2005 12:45 pm   Post subject: strint help

does anyone know how to get strint to work? I can't seem to get my inputed number to convert into a number to compare with a sum of 2 random numbers Sad . any help would be greatly appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Nov 11, 2005 1:03 pm   Post subject: (No subject)

Turing:

put strint ("1") + 1

or just have user input the number directly
Turing:

var num : int
get num
put num + 1

then there's no need for strint()
codemage




PostPosted: Fri Nov 11, 2005 1:05 pm   Post subject: (No subject)

Like so:

code:
var s : string
var i : int

get s % ie s = "12345"
i := strint(s)
MysticVegeta




PostPosted: Fri Nov 11, 2005 6:58 pm   Post subject: (No subject)

I suggest that you also pay a little attention to the "strintok" command. Useful for errortraping later.
do_pete




PostPosted: Mon Nov 14, 2005 11:37 am   Post subject: (No subject)

yeah you could go:
code:
var input : string
var interger : int
loop
    put "Enter a number: " ..
    get input
    exit when strintok (input)
end loop
interger := strint (input)
codemage




PostPosted: Mon Nov 14, 2005 1:00 pm   Post subject: (No subject)

Even better if you give the user some feedback on incorrect input.

code:
loop
    put "Enter a number: " ..
    get input
    exit when strintok (input)
    put "How about an actual number this time, wiseguy."
end loop
wtd




PostPosted: Mon Nov 14, 2005 1:24 pm   Post subject: (No subject)

codemage wrote:
Even better if you give the user some feedback on incorrect input.

code:
loop
    put "Enter a number: " ..
    get input
    exit when strintok (input)
    put "How about an actual number this time, wiseguy."
end loop


If it helps so see the control flow a bit more clearly.

code:
loop
    put "Enter a number: " ..
    get input
 
    if strintok (input) then
        exit
    else
        put "How about an actual number this time, wiseguy."
    end if
end loop
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  [ 7 Posts ]
Jump to:   


Style:  
Search: