How do I convert a single char in string to an int

Posted by Guest on Stack Overflow See other posts from Stack Overflow or by Guest
Published on 2010-04-03T23:33:28Z Indexed on 2010/04/03 23:43 UTC
Read the original article Hit count: 211

Filed under:
|
|
|
|

Keep in mind, if you choose to answer the question, I am a beginner in the field of programming and may need a bit more explanation than others as to how the solutions work.

Thank you for your help.

My problem is that I am trying to do computations with parts of a string (consisting only of numbers), but I do not know how to convert an individual char to an int. The string is named "message".

for (int place = 0; place < message.size(); place++)
        {
            if (secondPlace == 0)
            {
                cout << (message[place]) * 100 << endl;
            }
        }

Thank you.

© Stack Overflow or respective owner

Related posts about c++

Related posts about char