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;

}

No comments:

Post a Comment