I am writing a program that asks for input of letters and and sorts them the letter and occurrence based on input. I'm at the end of my code and I am trying to convert the uppercase letters to lowercase. I'm trying to do this:
cout << tolower(char('A'+i)) << " " << alphabets[i] <<endl;
But the tolower()
outputs a number instead of the lowercase version of the letter? Like for example, input "aaaa"
gives me :
97 4
and input "bbbbb"
gives me:
98 5
But when I take out the tolower
, input like "aaa"
will be:
A 3
I don't understand why this is happening.