A char is an integral type. When you write
char ch = 'A';
you set the value of ch to any number that your compiler uses to represent the character 'A' . This is usually the ASCII code for 'A' these days, but it is not required. You almost certainly use a system using ASCII.
Like any number type, you can initialize it with a regular number:
char ch = 13;
If you want to do arithmetic by char value, just do this: ch = ch + 1; etc.
However, in order to display the value that you have to bypass the assumption in the iostreams library, you want to display char values as characters, not numbers. There are several ways to do this.
std::cout << +ch << '\n'; std::cout << int(ch) << '\n'
source share