Using atof. : convert from string « Data Types « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

#include <cstdlib>
using std::atof;

int main()
{
   double d = atof( "99.0" );

   cout << d / 2.0 << endl;
   return 0;
}
49.5








2.29.convert from string
2.29.1.Using atof.
2.29.2.Using atoi
2.29.3.Using atol
2.29.4.Using strtod
2.29.5.Using strtol
2.29.6.Using strtoul