Character Restriction

How can I restrict the user to input characters for e.g. if I ask them for a number?
This is a very common question, asked about once a week.

Here's a fancy response.
http://www.cplusplus.com/forum/beginner/13044/page1.html#msg62827
Lines 29 through 41 are the ones that should interest you most.

Perhaps I ought to make an article about this. Oh wait, someone already did:
http://www.cplusplus.com/forum/articles/6046/

(Sorry if I sound rude. That is not my intention.)


I'm still thinking about an article for this though...
Thank you Duoas for the reply, I also had one more question, I tried declaring a string but it seems that Visual C++ Express 2008 doesn`t recognize is. Is string s; the right way to declare it or do I have to do something else? Thanks again.
You need to #include<string>
If you are not using namespace std; add std:: before string
Topic archived. No new replies allowed.