how to compare lower case character to uppercase cpp

C++
for(int i=0;i<str.size();i++){
int c = str[i]; 
        if (islower(c))  
            str[i] = toupper(c);
}
Source

Also in C++: