CPPForSchool.com: String Set 1 Assignment 12

12. Write the output of the following program

int main()
{
    char name[] = "CoMPutER";
    for (int x = 0; x < strlen(name); x++)
        if (islower(name [x]))
            name [x] = toupper(name[x]);
        else
            if (isupper(name[x]))
                if (x % 2 == 0)
                    name[x] = tolower(name[x]);
                else
                    name[x] = name[x-1];

     cout << name;
    
     return 0;
}
---------------------------------------------
cOmmUTee

Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 9

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8