Question: I was trying to write a program which will convert every word(either upper or lower case) in the upper or lower case(depending on which case is max).So here is my program

```
#include<iostream>
#include<cstring>
#include<cctype>
#include<cstdio>
using namespace std;
int main()
{
    char s[101];
    int c=0, sm=0, i;

    cin>>s;

    for(i=0;i<strlen(s);i++)
    {
        if(s[i]>='A' && s[i]<='Z')
            c++;
        else
            sm++;
    }

    if(sm>c)
    {
        for(i=0;i<strlen(s);i++)
        {
            //cout<<tolower(s[i])<<endl;
            putchar(tolower(s[i]));
        }
    }
    else
    {
        for(i=0;i<strlen(s);i++)
        {
            //cout<<toupper(s[i])<<endl;
            putchar(toupper(s[i]));
        }
    }
}

```

**But i was surprised to see that if i write these statement**

```
if(sm>c)
    {
        for(i=0;i<strlen(s);i++)
        {
            cout<<tolower(s[i])<<endl;                
        }
    }

```

***or***

```
else
    {
        for(i=0;i<strlen(s);i++)
        {
            //cout<<toupper(s[i])<<endl;
            putchar(toupper(s[i]));
        }
    }

```

***then it seems that output is in ASCII number.Can anyone explain me these reason.I am new to c++, so not much aware of cout***

Answer: 
The reason behind this is the `tolower()`. The return type of `tolower()` is int.

That means its equivalent to printing an integer, rather than a character.

If you want to show it correctly, use this:

```
cout << static_cast<char>(tolower(s[i])) << "\n";

```
cout prints the value, and in C++ a tolower returns a int (ASCII) so what you get is that, if you want to yell the actual character you need to convert manually the output.

```
cout<<static_cast<char>((s[i]))<<endl;

```

[Online editor to C++ (example)](http://cpp.sh/7k47k)