Computer Science Canada Exponents in Turing? |
Author: | qmanjr5 [ 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] |
Author: | TheGuardian001 [ 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. |
Author: | mirhagk [ Thu Jan 07, 2010 11:41 am ] | ||
Post subject: | RE:Exponents in Turing? | ||
If you enter
it will output 4. Whenever you enter an equation into the put command, it will display the answer |
Author: | qmanjr5 [ 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
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? |
Author: | Draymire [ 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
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.
|