Changing a lowercase character to uppercase in c++

Look here:

if(islower(letter))
{
    letter = isupper(letter);
    cout << letter;
}

If the character is lower, then you assigned it the return value of isupper. That should be 0. So you print a null character.

Why don't you just call toupper for every character that you enter? If it's lower it will convert it, if it is already upper it won't do anything.


Because you print a bool value (i.e. false, aka, NUL character here) in the first time.

You should change

letter = isupper(letter);

to

letter = toupper(letter);