i want to write some code that can input only number or only character ?
plz help me ???
chamnab
0
Junior Poster in Training
Recommended Answers
Jump to PostCheck out the header <cctype>, as it has isalpha(), isdigit(), etc.
Jump to Postwhy not use cin object as a test condition? That way it can get type mismatch and it won't write data to that type and we can easily get rid of bad input and ask user to reenter with proper data. Would this be a bad approach?
All 6 Replies
doctorkasim
0
Newbie Poster
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
Crutoy
0
Junior Poster in Training
Dha...1
0
Newbie Poster
chamnab
0
Junior Poster in Training
jonsca
1,059
Quantitative Phrenologist
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.