// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

void str2fp(string s)
{
    stringstream ss(s);
    double x;
    ss >> x;
    if(ss.fail())
        cout << s << " is not a double" << endl;
    else
        cout << s << " = " << x << endl;
}

int main()
{
    str2fp("123.45");
    str2fp("abc");
    return 0;
}
