Instead of looping an entire string just to convert each character to upper or lower case using toupper() or tolower(), we simply use strcmpi().
Sample Program:
Note: strcmpi() accepts 2 parameters, both are of type char[] that is why we called the function c_str() to convert s1 and s2 from string to char[].
No comments:
Post a Comment