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

Username:   Password: 
 RegisterRegister   
 Exponents in Turing?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
qmanjr5




PostPosted: Thu Jan 07, 2010 9:23 am   Post subject: Exponents in Turing?

What is the command to put 1 to the exponent of 10 and will it do it?

Say if I put 1 to the exponent of 10, would it display the answer?

And how do I do it[/img]
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Thu Jan 07, 2010 9:50 am   Post subject: Re: Exponents in Turing?

I believe the operator is ** in turing, ie 2 ** 2 = 4

Although you could save yourself the time and just output 1, since 1 to the power of anything is still 1.
mirhagk




PostPosted: Thu Jan 07, 2010 11:41 am   Post subject: RE:Exponents in Turing?

If you enter
Turing:

put 2**2

it will output 4. Whenever you enter an equation into the put command, it will display the answer
qmanjr5




PostPosted: Fri Jan 08, 2010 11:25 am   Post subject: RE:Exponents in Turing?

Okay, I get what you're saying, but, I'm not sure about using variables and such. If I did
Turing:

var equation1 := int
get equation1
put equation1


And the user inputs "2**2"
would it display 4 or "2**2"?



EDIT: Okay, that doesn't work. how would I make it so an inputted equation would then be evaluated and then outputted?
Draymire




PostPosted: Fri Jan 08, 2010 2:03 pm   Post subject: Re: Exponents in Turing?

You could try it as a string but i doubt that would work.
your best bet would be to get 2 variables

code:

var a,b:int
get a
get b
put a**b


then all you would just have to create a way to have your program ask for what type of equation you are going to use.
maybe display the equation and ask for each variable individually.

code:

put "(x**y)/z"
put "enter x"
get x
put "enter y"
get y
put "enter z"
get z
put (x**y)/z
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  [ 5 Posts ]
Jump to:   


Style:  
Search: