// converts string to int if string is in integral range
int main() {
string str1 = "123";
int x = stoi(str1);
cout << x;
}
// convert Binary to Decimal in cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
char ch[] = "111";
cout<<stoi(ch , 0 ,2);
return 0;
}
// convert string to int number.
int number = stoi(str)
int number = stoi(str,nulptr,10);//base 10
int number = stoi(str.c_str());
stoi()
//a function used to convert string to integer!
#include<bits/stdc++.h>
using namespace std;
int main() {
string s = "13245";
int stringToInt = stoi(s);
cout << stringToInt; // outputs 12345
return 0;
}