Computer Science Canada Creating a Simple Error Trap |
Author: | uknown blank [ Mon Jan 18, 2010 6:25 pm ] |
Post subject: | Creating a Simple Error Trap |
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> How do you create an error trap. Can someone please give me a simple example. This is what i have so far strintok and strint but i need one for real numbers and integers |
Author: | TheGuardian001 [ Mon Jan 18, 2010 6:54 pm ] |
Post subject: | Re: Creating a Simple Error Trap |
All valid integers can be stored as real numbers with intreal (no error check needed). Real numbers can be safely converted to an int by rounding (no error check needed). |
Author: | andrew. [ Mon Jan 18, 2010 8:03 pm ] |
Post subject: | RE:Creating a Simple Error Trap |
So to sum it up: String -> Int check: strintok String -> Int: strint String -> real check: strrealok String -> real: strreal real -> String: realstr Int -> String: intstr Int -> Real: intreal Real -> Int: round |