Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Error Proofing Arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lucklesslily




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Nathan4102




PostPosted: Wed Jan 13, 2016 12:14 pm   Post subject: RE:Error Proofing Arrays

Have you learned about conditional statements?
lucklesslily




PostPosted: Fri Jan 15, 2016 11:33 am   Post subject: Re: Error Proofing Arrays

No I haven't
Insectoid




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: