0

How to covert letter 'A' to letter 'B' using ASCII code?

Also mention if there is any other way to solve the problem....

27th Aug 2019, 6:03 AM
Nischal Jain
Nischal Jain - avatar
4 Réponses
+ 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
27th Aug 2019, 6:27 AM
Ipang
27th Aug 2019, 6:19 AM
Trigger
Trigger - avatar
+ 1
Pseudocode: ASCII("B") = ASCII("A") + 1 They follow each other in the alphabet
27th Aug 2019, 6:07 AM
Trigger
Trigger - avatar
27th Aug 2019, 6:24 AM
Trigger
Trigger - avatar