Computer Science Canada Error Proofing Arrays |
Author: | lucklesslily [ Wed Jan 13, 2016 10:47 am ] |
Post subject: | Error Proofing Arrays |
What is it you are trying to achieve? I'm in the midst of error proofing my program, and at the moment I need to make sure that people enter the right type of input into my arrays. (real) What is the problem you are having? I have no idea how to do that. Describe what you have tried to solve this problem I tried using strintok/strint but it didn't work. Post any relevant code for itemCount : 1..numBooks put "Enter a title:" get arritemDescrip (itemCount) :* cls put "Enter number of copies you would like to recieve of ",arritemDescrip(itemCount),":" get arritemQuantity(itemCount) cls put "Enter price of an individual copy of ",arritemDescrip(itemCount),":" get arritemPrices(itemCount) arrtotalPrice(itemCount) := arritemQuantity(itemCount) * arritemPrices(itemCount) cls end for Please specify what version of Turing you are using Turing 4.1.1 |
Author: | Nathan4102 [ Wed Jan 13, 2016 12:14 pm ] |
Post subject: | RE:Error Proofing Arrays |
Have you learned about conditional statements? |
Author: | lucklesslily [ Fri Jan 15, 2016 11:33 am ] |
Post subject: | Re: Error Proofing Arrays |
No I haven't |
Author: | Insectoid [ Fri Jan 15, 2016 3:03 pm ] |
Post subject: | RE:Error Proofing Arrays |
A conditional statement is the same as an if statement. I'm sure if you're working with arrays then you've probably learned ifs by now. strint/strintok are for converting strings to integers. To convert to real use strreal/strrealok. |