C++ examples for Data Type:int
Use atol to convert string to long value
#include <iostream> #include <cstdlib> // atol prototype using namespace std; int main() /*www. j av a2s .c om*/ { long x = atol( "1000000" ); // convert string to long cout << "The string \"1000000\" converted to long is " << x << "\nThe converted value divided by 2 is " << x / 2 << endl; }