Advertisement
khaiwen1111

Practical 9 Part B Question 1

Apr 6th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cctype>
  3. using namespace std;
  4.  
  5. int main(void)
  6. {
  7.     char ch, next_ch;
  8.    
  9.     cout <<"Enter an alphabetic character: ";
  10.     cin >> ch;
  11.  
  12.     if (isalpha (ch))
  13.     {
  14.             if ((ch == 'z'))
  15.                 next_ch = 'a';
  16.             else if (ch == 'Z')
  17.                 next_ch = 'A';
  18.             else
  19.                 next_ch = ch + 1;
  20.         cout << "Next character of " << ch << "is" << next_ch << ".\n";
  21.     }
  22.     else
  23.         cout << ch <<"is not alphabetic character.\n";
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement