Search Your Query

Custom Search

Tuesday, 24 May 2011

TUL Case (Title, Upper, Lower )


 #include <iostream.h>

void main()
{
    char name[30];
    cin >>  name;
    if ( !(name[0] > 64 && name[0] < 91 ))
    {
        name[0] = name[0] - 32;
    }

    for ( int i=1 ; i <= 29 ; i++ )
    {
        if ( name[i] != 0 )
        {
        if (!( name[i] > 96 && name[i] < 123 ))
        {
            name[i] = name[i] + 32;
        }
        }
    }
    cout << "Name in Title Case is: " << name << endl << endl;

    for ( i=0 ; i <= 29 ; i++ )
    {
        if ( name[i] != 0 )
        {
        if (!( name[i] > 64 && name[i] < 91 ))
        {
            name[i] = name[i] - 32;
        }
        }
    }

    cout << "Name in Upper Case is: " << name << endl << endl;

    for ( i=0 ; i <= 29 ; i++ )
    {
        if ( name[i] != 0 )
        {
        if (!( name[i] > 96 && name[i] < 123 ))
        {
            name[i] = name[i] + 32;
        }
        }
    }

    cout << "Name in Lower Case is: " << name << endl << endl;

}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...