Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if a string is a number?

Status
Not open for further replies.

epx

Programmer
Feb 18, 2002
3
US
I am in a beginning programming class. We are writing a calculator program. I would like to know how I can cin to a string then check if the string is a number (float or int) or a command (of type char: / + - *) if it is a number is needs to be converted to float, if it is a command it needs to be converted to char. Any ideas? Thanks!

-epx
 
Hi

there is a set of functions for these checks:

isalnum, isalpha, isprint, __isascii, ispunct,
isspace, isdigit, isgraph, islower, isupper

Just check the doc for details about usage

HTH

Thierry
EMail: Thierry.Marneffe@swing.be
WebSite:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top