edit: never mind. Handled by others.
edit: never mind. Handled by others.
Last edited by FillYourBrain; 10-13-2004 at 02:19 PM.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Yes I want to populate an array with 5 numbers (between 0-9) and check that the user only enteres a number between 0 and 9, then read it out backwards.
Best regards, global
ooops. sorry 'bout that. Thank you misplaced.
You don't need to convert the input to a char to check that user input only values 0-9. You can use an array of int. Use a loop to get the ints. Check that input is in the range you want. Store each input in the array in order they are received. Print them out backward using a loop starting at last valid index and decreasing loop counter each loop through.
Yes, but what if the user enters a letter by mistake?
Thanks for your help, global
Originally Posted by global
*i believe there is a function/macro call isalpha()...
if you're using an ide with documentation look in the help index for it
i seem to have GCC 3.3.4
But how do i start it?
I dont have a menu for it or anything.
Input validation by accepting input as a string and converting after validation or by using the cin.fail(), cin.good(), cin.ignore(), cin.clear() methods are both valid. Whichever way you feel more comfortable should work.
How would i convert it after validation? If i want to input 5 numbers as characters. check convert it, check that it is above 0 and below 9 - how would this be done. I thought this would be easy, but people just say 'convert' - but i have yet to achieve this.
I do appreciate your help.
Regards, global