g ++ (Ubuntu / Linaro 4.6.1-9ubuntu3) 4.6.1
#include <errno.h>
...
cin >> str;
errno = 0 ;
double d = strtod(str.c_str(), NULL);
if (errno) {
cout << "Please, enter number.";
}
при неправильном вводе errno
остаться 0.
Редакция:
Следующая отлично работает:
char *err;
double d = strtod(str.c_str(), &err);
if (strlen(err)) {
cout << "Please, enter number." << endl;
}