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.";
}
on wrong input errno
stay 0.
EDITED: Next works fine:
char *err;
double d = strtod(str.c_str(), &err);
if (strlen(err)) {
cout << "Please, enter number." << endl;
}