Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int count_upper(char str[]);
- int search_char(char str[], char search_ch);
- int main(void)
- {
- return 0;
- }
- int count_upper(char str[])
- {
- int count = 0;
- for(int i = 0; i < strlen(str); i++)
- if (isupper(str[i]))
- count++;
- return count;
- }
- int search_char(char str[], char search_ch)
- {
- int count = 0;
- for(int i = 0; i < strlen(str); i++)
- //if ignore cases -> if(toupper(str[i]) == toupper(search_ch)
- if (str[i] == search_ch) //case sensitive
- count++;
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement