No matter what I do, I always get the numeric value from the ASCII chart. In this case I get 104, even though I denote Name[2] as a character.
string Name= "John";
cout << tolower ( char ( Name[2]) ) << endl;
No matter what I do, I always get the numeric value from the ASCII chart. In this case I get 104, even though I denote Name[2] as a character.
string Name= "John";
cout << tolower ( char ( Name[2]) ) << endl;
Try
cout << (char) tolower ( Name[2] ) << endl;
>>No matter what I do, I always get the numeric value from the ASCII chart. In this case I get 104, even though I denote Name[2] as a character
Thats because tolower() prototype is declared as, int tolower(int c).
So it takes a int and returns a int.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.