Hello fellow programmers...
I would like to know if there's any good way to convert a string to int ?
An example:
void main{
string Numbers;
string Temp;
int Number;
Numbers = "12345";
Temp.assign(Numbers,0,1); //assigns the first number in the string to Temp
cout << "Temp is : " << Temp; getch(); //Temp here displays "1"
Number = Temp; //this doesn't seem to work
cout << "The number is : " << Number; getch();
}
Can anyone help me with this ??
I would like to know if there's any good way to convert a string to int ?
An example:
void main{
string Numbers;
string Temp;
int Number;
Numbers = "12345";
Temp.assign(Numbers,0,1); //assigns the first number in the string to Temp
cout << "Temp is : " << Temp; getch(); //Temp here displays "1"
Number = Temp; //this doesn't seem to work
cout << "The number is : " << Number; getch();
}
Can anyone help me with this ??