Image

Imagetransmogrify wrote in Imagecpp

temperature conversion program

i'd like to edit the following program so that if a user inputs a character other than a number that it'll print something like- "Your entry is invalid."

**********************

#include <iostream.h>

int main()
{
cout << "Temperature Conversion Program." << endl;
cout << "Enter degrees Celsius from 0 to 100: ";

double celsius;
while(!(cin >> celsius)){
cout << "Enter degrees Celsius from 0 to 100: ";
}

if((celsius < 0) || (celsius > 100)){
cout << "The number you entered is invalid." << endl;
}
else
{
double fahrenheit = celsius*(9.0/5.0)+32;
cout << celsius << " degrees Celsius = ";
cout << fahrenheit << " degrees Fahrenheit = "<< endl;
}
return 0;
}
**********************

any ideas?
cross posted Imagecoders_haven