I am trying to convert the contents of string num to an integer variable sum but for some reason my code will not compile. Can some one please tell me what I am doing wrong? Thanks so much!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <string>
#include <cstdlib>
usingnamespace std;
int main()
{
string num = "435";
int sum = 0;
sum = atoi(num);
cout << sum << endl;
return 0;
}