Computer Science Canada Calculating interest / Help with functions |
Author: | Skilgannon [ Sun Feb 05, 2006 2:36 pm ] | ||
Post subject: | Calculating interest / Help with functions | ||
I don't quite understand how functions work, and that's probably why this isn't working so well. Basically, you input the original amount of money, the interest rate and the number of years , and it's compounded yearly. For some odd reason, it only outputs the first number following "result" Can someone help me out ?
|
Author: | md [ Sun Feb 05, 2006 2:58 pm ] |
Post subject: | |
I don't know why it would be outputing "result" but I do know that money is not an integer value. You should be using floating point varaibles instead of integers. |
Author: | Skilgannon [ Sun Feb 05, 2006 4:22 pm ] |
Post subject: | |
Thanks, I figured it out. |
Author: | md [ Sun Feb 05, 2006 4:22 pm ] |
Post subject: | |
I'm not actually a turing user, so I don't know exactly what the type would be, but try "float", "double" or "real". Basically it's a variable that can keep track of decimal numbers. |
Author: | Delos [ Sun Feb 05, 2006 4:58 pm ] |
Post subject: | |
Cornflake wrote: I'm not actually a turing user, so I don't know exactly what the type would be, but try "float", "double" or "real". Basically it's a variable that can keep track of decimal numbers.
Oh I wish Turing had floats and doubles...would be so much more memory effcient! I believe it does have some other random things with regards to natural numbers... |
Author: | md [ Sun Feb 05, 2006 5:18 pm ] |
Post subject: | |
Turing doesn't support floats or doubles?! /me shakes his head and walks away |
Author: | Martin [ Sun Feb 05, 2006 9:24 pm ] |
Post subject: | |
Turing calls this type real. var n : real |