Computer Science Canada Error when using math with ints. |
Author: | ynotpeace [ Wed Dec 09, 2009 2:01 pm ] | ||
Post subject: | Error when using math with ints. | ||
What is it you are trying to achieve? here is a basic line of code i did using 3 variables ( all integers) What is the problem you are having? the int "cases" is highlighted and the error is: "assigned value is the wrong type" Describe what you have tried to solve this problem I've tried everything i can think of... Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 |
Author: | DemonWasp [ Wed Dec 09, 2009 2:12 pm ] |
Post subject: | RE:Error when using math with ints. |
...and what types do the variables avg, casetot and cases have? There are plenty of combinations that just won't work, and you haven't provided us nearly enough information here (we need to see the variable declarations). |
Author: | TheGuardian001 [ Wed Dec 09, 2009 2:38 pm ] |
Post subject: | Re: Error when using math with ints. |
Actually I believe the int type in turing just flat out rejects the / operator unless you round it. if you want to use division with ints, use div, which will automatically round it. |
Author: | ynotpeace [ Wed Dec 09, 2009 2:39 pm ] | ||||
Post subject: | Re: Error when using math with ints. | ||||
sorry about that. I'm new to this heres the declorations:
here is my whole code ( i dont think you'll understand the purpose of this code though):
|
Author: | ynotpeace [ Wed Dec 09, 2009 2:41 pm ] |
Post subject: | Re: Error when using math with ints. |
Thank you guardian ^.^ |
Author: | mirhagk [ Wed Dec 09, 2009 4:09 pm ] | ||||||||||
Post subject: | RE:Error when using math with ints. | ||||||||||
just a tip, read up on arrays. instead of
you can do the following
or better yet
(also you can just do the following)
instead of
|