title: Converting a string of numbers to any form of an int
body: <p>As a part of a larger program, I must convert a string of numbers to an integer(eventually a float). Unfortunately I am not allowed to use casting, or atoi.</p>
  
  <p>I thought a simple operation along the lines of this:</p>
  
  <pre><code>void power10combiner(string deciValue){
     int result;
     int MaxIndex=strlen(deciValue);
          for(int i=0; MaxIndex&gt;i;i++)
          {
            result+=(deciValue[i] * 10**(MaxIndex-i));
          }       
  }
  </code></pre>
  
  <p>would work. How do I convert a char to a int? I suppose I could use ASCII conversions, but I wouldn't be able to add chars to ints anyways(assuming that the conversion method is to have an enormous if statement that returns the different numerical value behind each ASCII number).</p>