Anyone knows how can a string that holds a number be assigned to a variable declared of integer data type ? I've tried to use casting but it fails to work.
eg. string temp = "26";
int num;
num = temp; ?! how to ?!
This is a discussion on Coversion of "String to Integer" ?! within the C++ Programming forums, part of the General Programming Boards category; Anyone knows how can a string that holds a number be assigned to a variable declared of integer data type ...
Anyone knows how can a string that holds a number be assigned to a variable declared of integer data type ? I've tried to use casting but it fails to work.
eg. string temp = "26";
int num;
num = temp; ?! how to ?!
you need atoi().....
if your quick, you will catch the example that Quzah has just posted on the C Board
run run run........![]()
Thanx a lot buddy ! Now, my program is working smoothly.