DC [27/05/2021]
FUNCTION CUSTOMTOUPPER:
Note: The fromChar always occurs before the toChar in the English alphabet set.
IMPORTANT: Do not write the main() function as it is already defined.
Example Input/Output 1:
Input:
SkillRack
h p
Output:
Modified String: SKILLRacK
Explanation:
In the given string S, the lower case alphabets that occur from h to p are k, i, l, l and k.
After converting the above lower case alphabets to upper case, the string becomes SKILLRacK.
Example Input/Output 2:
Input:
MicTesting#One#Two#Three
a m
Output:
Modified String: MICTEstInG#OnE#Two#THrEE
****************************************
CODE SNIPPET:
void customToUpper(char str[], char fromChar, char toChar)
{
for(int i=0;i<strlen(str);i++)
{
if(str[i]>=fromChar && str[i]<=toChar)
{
str[i]=toupper(str[i]);
}
}
}
****************************************
Comments
Post a Comment