can a character be converted in an integer inside the main function? how?

i need some help.
Nice title!
A character is already an integer
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main()
{
	char c = 'a';
	int i = c;

	std::cout << c << " = " << i << std::endl;

	return 0;
}
i think the best way is to use the switch function
hopefully this tutorial should guide you.
http://www.youtube.com/watch?v=FPKmFdNP5_A
first: the switch is not a function,
second: that tutorial is terrible,
third: it's completely unrelated to the question
Last edited on
Bazzy wrote:
first: the switch is not a function
... It is a Control Structure.
Topic archived. No new replies allowed.