Using atoi() function
#include <stdlib.h> #include <iostream> using namespace std; int main() { char buffer[80]; cout << "Enter a number: "; cin >> buffer; int number; number = atoi(buffer); cout << "Here's the number: " << number << endl; int sum = atoi(buffer) + 5; cout << "Here's sum: " << sum << endl; return 0; }