
-----------------------------------
qmanjr5
Thu Jan 07, 2010 9:23 am

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]

-----------------------------------
TheGuardian001
Thu Jan 07, 2010 9:50 am

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
Thu Jan 07, 2010 11:41 am

RE:Exponents in Turing?
-----------------------------------
If you enter

put 2**2

it will output 4. Whenever you enter an equation into the put command, it will display the answer

-----------------------------------
qmanjr5
Fri Jan 08, 2010 11:25 am

RE:Exponents in Turing?
-----------------------------------
Okay, I get what you're saying, but, I'm not sure about using variables and such. If I did 

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
Fri Jan 08, 2010 2:03 pm

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
[/code]

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
[/code]
