0
How to covert letter 'A' to letter 'B' using ASCII code?
Also mention if there is any other way to solve the problem....
4 odpowiedzi
+ 3
char type internally stores a number (8bit integral value) and you can manipulate it as you would any integral value.
That is, you can use ++ or -- operator to increment or decrement the value, and hence also the character it represents.
char c {'A'};
std::cout << c++ << std::endl; //post increment, here <c> still holds 'A'
std::cout << c << std::endl; // here <c> has incremented to become 'B'
Hth, cmiiw
+ 1
Pseudocode:
ASCII("B") = ASCII("A") + 1
They follow each other in the alphabet