C++ examples for Data Type:double
Using atof to convert string to double
#include <iostream> #include <cstdlib> // atof prototype using namespace std; int main() //from ww w . ja v a2 s. co m { double d = atof( "99.0" ); // convert string to double cout << "The string \"99.0\" converted to double is " << d << "\nThe converted value divided by 2 is " << d / 2.0 << endl; }