Lines 10 and 17. You define nCelsius as an integer, then you read it in as integer. If it's NOT an integer, the >> operation fails. Since you can't ASSUME it's an integer (that's the whole reason you're checking), you can't read it in as an integer. Read it in as a string, THEN check to see whether it's an integer.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
You're trying to test a numerical value for an ASCII character!
if(!isdigit(nCelsius))
isdigit( char ) thus "9834" first character '9'
But its encoded as 9834 an integer.
What they said! Simultaneous posting!
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99