title: why atoi() function from #include<cstdlib> is not working
body: <p>I created a program to convert a number into its binary format using a string(r), now I want to convert it into integer data type, I found atoi() function(import from cstdlib) on google for conversion from string to integer but its not working.</p>
  <p>Here is my code- it shows error<a href="https://i.stack.imgur.com/cKe2R.png" rel="nofollow noreferrer"> click here to see it</a></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  int main()
  {
      int num,n;string r;
      cout&lt;&lt;&quot;Enter the number : &quot;;
      cin&gt;&gt;num;
      while(num!=0){r = (num%2==0?&quot;0&quot;:&quot;1&quot;)+r;num/=2;}
      cout&lt;&lt;&quot;\nBinary value is &quot;&lt;&lt;r&lt;&lt;endl;
      n = atoi(r);
      cout&lt;&lt;n;
      return 0;
  }
  </code></pre>