Stoi
#include <iostream>
#include <string>
using namespace std;
int main() {
string a = "500";
int x = stoi(a);
cout << x << endl;
}
Phani Simha
#include <iostream>
#include <string>
using namespace std;
int main() {
string a = "500";
int x = stoi(a);
cout << x << endl;
}
int stoi (const string& str, size_t* idx = 0, int base = 10);
int stoi (const wstring& str, size_t* idx = 0, int base = 10);