Write a program which accepts a character and display its next character.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include <iostream> using namespace std; int main() { char inputChar, nextChar; cout << "Enter a character: "; cin >> inputChar; // Calculate the next character using ASCII values nextChar = inputChar + 1; cout << "Next character: " << nextChar << endl; return 0; } |
Output
Enter a character: A
Next character: B