Computer Science Canada Math with decimals |
Author: | aldreneo [ Mon Jun 19, 2006 2:25 pm ] | ||||
Post subject: | Math with decimals | ||||
How do I make it so that numberone has a decimal in it and still be able to do math with it? Example output I would like:
|
Author: | r.3volved [ Mon Jun 19, 2006 2:45 pm ] |
Post subject: | |
Data type of integer uses whole numbers with no decimal places. so your datatype should be (been a long time since I used hideous turing) Double, Float, Real or Decimal...whatever turing uses |
Author: | Delos [ Mon Jun 19, 2006 2:46 pm ] | ||
Post subject: | |||
You could simply use real variables instead:
Also, you don't print output in Turing, you put it . |
Author: | aldreneo [ Mon Jun 19, 2006 3:05 pm ] |
Post subject: | |
Thanks And allmost every other language uses print why does turing use put? |
Author: | Delos [ Mon Jun 19, 2006 3:35 pm ] | ||
Post subject: | |||
Why does Ruby use 'puts'? I'm not sure there's a satisfactory answer to that. If it makes you feel better, you could add this to an Output module:
|
Author: | s3arkay [ Mon Jun 19, 2006 3:43 pm ] | ||
Post subject: | |||
That would print the number with 2 decimals even if it didnt have any, Example : 2.00 |
Author: | aldreneo [ Tue Jun 20, 2006 9:33 am ] | ||
Post subject: | |||
but, that would be without rounding s3arkay wrote:
That would print the number with 2 decimals even if it didnt have any, Example : 2.00 |