I'm trying to understand this function. I try to compile an run it, but it gives an error message at line 12. Thanks.
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int stringConvertInt(string raw)
{
int sum=0, power=0;
power=raw.length()-1;
for(int i=0; i<raw.length(); i++)
{
sum=sum+(pow(10,power)*(raw[i]-48));
power--;
}
return sum;
}
int main( )
{
stringConvertInt("Joe");
return 0;
}