I have a string that is in the c++ format. It includes both letters and numbers and I want to convert it to a interger that has those same letters and numbers. I know that atoi will not work and its the same with int() what do i do. I'm going crazy from looking in books fo a answer. I need this finish by the weekend someone please help.
How's that? Integer is just a number - decimal number. Decimal numbers can not contain letters. What exactly are you trying to do?
I have characters such as I0 and -I4 assigned to integers(numbers) in an enumeration. I'm picking these up from a file as characters and turning them into a string. But I need them to match the enumeration for me to pass it to the rest of my program. The only way I can see to do this is to make the string equal the integers. I'm a physics major not computer science. If you can tell me another way to get around this I will be greatful
You can use an associative array to store them with the string as the key and the integer as the value.
$myarray["I0"] = 0; $myarray["-I4"] = 1;