Are you trying to convert a char to an int? If so, that is easy, since chars are ints with a limited range. An implicit cast will do:
Code:
char ch = 'A';
int num = ch;
If you do not want to use a temporary like that, you could always do an explicit cast:
Code:
char ch = 'A';
std::cout << static_cast<int>(ch) << std::endl;
If you are trying to convert a string to an int, on the other hand, then that needs a little more work, usually by using a stringstream with <sstream>, or atoi() from <cstring>, or perhaps something like Boost's lexical_cast.