Im making a simple program that orders numbers from least to greatest. Is there a way for the user to enter all of his numbers and type "done" and the program will recognize it? I've only been using cout, and I try to store the numbers in a string and test it with an if statement, but i can't convert it to an integer in order to use the numbers in the program. Help?
@ OP: Yeah the part about storing the numbers in the string. Don't do that. I'd test the users input with isalpha(...) see here: http://www.cplusplus.com/reference/clibrary/cctype/isalpha/
That way if his input is a number it returns false and you store it in your vector, if it is a letter, any letter, then you wrap it up and go to the next part of your program. It's just easier, you could go a step further and verify that the user actually DID enter "done" or any number of other commands you decide on later but that's something to worry about once you get rolling.