// in convert.h double convertToDouble(const string& s) { istringstream i(s); double x; i >> x; return x; } // in number.cpp double x = convertToDouble( strInput ); cout << x + 10 << endl; // for testing /** I tried this with no luck: **/ // in convert.h double convertToDouble(const string& s) { istringstream i(s); double x; for ( j = 0; j < 5; j++ ) i >> x; return x; } // and also tried while looping it. I is not an array, so how do I advance it?