kathy wrote:
I can not find something like atof() which can convert string to
double.
Can anyone help me?
#include <iostream>
#include <sstream>
using namespace std;
double strtodouble(const string& what)
{
istringstream instr(what);
double val;
instr >> val;
return val;
}
int main()
{
string dbl("3.1415");
cout << strtodouble(dbl) << endl;
return 0;
}
--
--dakka
Dykstra's Observation:
If debugging is the process of removing bugs, then programming must be
the process of putting them in.