Ask your own question, for FREE!
Computer Science 12 Online
OpenStudy (anonymous):

Could anyone help me with this C++ task: I need to read numbers that are being entered separated by spaces and store them into an array. At the same time, I have to filter out non-numbers entered, expect 'x' which is the sentinel value. I am having a brain block on how to achieve this. Thank you for any help.

OpenStudy (rsmith6559):

Isn't there a Scanner class to break the string down? I think the String class has conversion methods.

OpenStudy (bibby):

<cctype> should have an isdigit function you can also write your own, but that'd be pointless.

OpenStudy (anonymous):

cin to get the numbers and then store them in an array. and yes isdigit is available of course.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!