Question
Download the template for case.c below under Submission Instructions. This program repeatedly reads strings from standard input (keyboard), halting when end-of-file (ctrl-d) is reached. For
Download the template for case.c below under Submission Instructions. This program repeatedly reads strings from standard input (keyboard), halting when end-of-file (ctrl-d) is reached. For each string, it calls a function, countCase, that takes the string as the first parameter and counts the number of uppercase letters and the number of lowercase letters in the string. The function reports the two counts through the last two reference parameters. The function signature for countCase is shown below: void countCase(char str[], int *pNumUpper, int *pNumLower); After calling the function, the main function should print the number of uppercase and lowercase letters in each string. Assume that each string has a length of 50 at most. An example is shown below. To determine if a character is uppercase or lowercase, you can #include : isupper(ch) - checks if 'A' <= ch <= 'Z' returns true (not 0) if it is is uppercase returns false (0) if it is not uppercase islower(ch) - checks if 'a' <= ch <= 'z' returns true (not 0) if it is is lowercase returns false (0) if it is not lowercase isupper and islower are not guaranteed to return 1 if it is true. When dealing with a reference parameter, ++ executes before *, so parentheses need to be used: (*pNumUpper)++; countCase should start the counts at zero or it will fail the unit tests. countCase should not assume numUpper and numLower are initialized to 0 before the function is called. Use this template: #include void countCase(char str[], int *pNumUpper, int *pNumLower); int main() { return 0; } void countCase(char str[], int *pNumUpper, int *pNumLower) { }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started