Showing posts with label small letter to capital. Show all posts
Showing posts with label small letter to capital. Show all posts

Sunday, August 23, 2015

Program to change Case of an Alphabet

Q. 87. Program to accept any Alphabet and change the Case



Copy Code:

#include <iostream>

using namespace std;


int main()

{

  char ch ;

  cout << "Enter an Alphabet : "; cin >> ch;

  

  if (ch>='A'  &&  ch<='Z')

     {

       ch+=32;  // ch=ch+32

       cout << "Lower case is "<< ch;

      }

  else if (ch>='a'  &&  ch<='z')

     {

      ch-=32;  // ch=ch-32

      cout << "Upper case is "<< ch;

     }

  else 

      cout << "Not an Alphabet";

  

return 0;

}