7. C++ Program to convert a lowercase alphabet to uppercase or vice-versa

#include<iostream>
using namespace std;

int main()
{
    char ch;
    cout<<"Enter any Alphabet ::" ;
    cin>>ch;

    if(ch>=65 && ch<=91)
        ch =ch + 32 ;
    else if(ch>=97 && ch<=123)
        ch = ch-32;

    cout<<ch;

}


#include<iostream>
using namespace std;

int main()
{
    char ch;
    cout<<"Enter any Alphabet ::" ;
    cin>>ch;

    if(islower(ch))
        ch = toupper(ch);
    else if(isupper(ch))
        ch = tolower(ch);

    cout<<ch;

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s