Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to convert string to int in c++

string s = "123";
int n = s.size();
int num = 0;
 for(int i = 0 ; i<n;i++)//this what stoi built function do XD
 {
  num = num*10+(s[i]-'0');
 }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #string #int
ADD COMMENT
Topic
Name
6+9 =