C++ examples for Data Type:int
Using atoi to convert string to int
#include <iostream> #include <cstdlib> // atoi prototype using namespace std; int main() /*from ww w . j av a 2 s .c o m*/ { int i = atoi( "1234" ); // convert string to int cout << "The string \"1234\" converted to int is " << i << "\nThe converted value minus 111 is " << i - 111 << endl; }