Conversion of character string to integer
How do I convert a character to an integer? For example if I have a character '1' how do I convert it into an integer type one. There is a good news and bad news. The bad news is that my character array starts out with "non-integer" characters and "integer" characters that gets tokenized and pushed into a queue data structure. The good news is that I'll be able to check if each element is an integer is not by some sort of test.
Code:
queue <char> Q1;
// after loading characters string, we need to see if each element is an integer
t = Q1.front();
if (t == integer)
// do mathematical operation
else {
// do something else
}
So, my question is how would you convert that character into a mathematical element? Thank you.