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

Username:   Password: 
 RegisterRegister   
 can i make a basic unkown int?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cheese188




PostPosted: Wed Apr 08, 2009 7:52 pm   Post subject: can i make a basic unkown int?

if i had the variable

Turing:
var n : int
n :=                %how can i make n unkown




BooHoo just thought id put that in cause it looks cool


Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
saltpro15




PostPosted: Wed Apr 08, 2009 7:57 pm   Post subject: RE:can i make a basic unkown int?

what do you mean by unknown? like a random number? if so, use
Turing:

var num := Rand.Int (1,100)

for example, that will create a random integer between 1 and 100
cheese188




PostPosted: Wed Apr 08, 2009 8:07 pm   Post subject: Re: can i make a basic unkown int?

not really i need like an integer that can be anything a user enters so i can use it in an if statement
with another integer like

code:
Turing:
var [color=blue]n[/color] : int
[color=blue]n[/color] := Rand.Int (1, 3)

var [color=blue]g[/color] : int
[color=blue]g[/color] := %this is the part I am confused about

if [color=blue]n [/color]= 1 then
   put [color=red]"kauf"[/color] ..     
   get [color=blue]g[/color]
end if

if [color=blue]g[/color] = [color=blue]n[/color] then
   put "[color=blue]jadg"[/color]
end if


kind of like a question, if n = 1 then it say's kauf then whoever enters g
then if the g they entered is the same as n then it say's jadg
what i need to know is how to make g 3 different values or any value
hope i explained it well enough[syntax=""][/syntax]
saltpro15




PostPosted: Wed Apr 08, 2009 8:30 pm   Post subject: RE:can i make a basic unkown int?

what's with all the extra brackets? I don't think they're necessary...

just use a get statement
code:

var n : int
get n
if n = 1 then
%do something
elsif n = 2 then
% do something else
cheese188




PostPosted: Wed Apr 08, 2009 8:36 pm   Post subject: Re: can i make a basic unkown int?

oh its so simple i did not think of putting a get statement before if statement
thanks a lot that's going to complete my program
saltpro15




PostPosted: Wed Apr 08, 2009 8:38 pm   Post subject: RE:can i make a basic unkown int?

no problem
Siavash




PostPosted: Sat Apr 11, 2009 7:35 am   Post subject: RE:can i make a basic unkown int?

I do
Turing:

var n :int
randint (n, 0, 10000)
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: