dimanche 22 mars 2020

What should i do when i use std::isupper() with accentuated letter

I have to check if the first character of a string is lower case or upper case.

It works good when i use english names like David but when a name with accentuated letter pops up like Á,É,Í,Ó etc.... (like Árpád) then it thinks it is lower case.

string name;
std::cin>>name;

if(std::isupper(name[0]))
{
std::cout<<"Upper case"<<std::endl;
}
else
{
std::cout<<"Lower case"<<std::endl;
}

Aucun commentaire:

Enregistrer un commentaire