- Challenge Activity 301722 2037154 Xxxxy7 Jump To Level 1 Complete The Function Countcharacters That Takes One String P 1 (13.99 KiB) Viewed 30 times
CHALLENGE ACTIVITY 301722.2037154.xxxxy7 Jump to level 1 Complete the function CountCharacters() that takes one string p
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
CHALLENGE ACTIVITY 301722.2037154.xxxxy7 Jump to level 1 Complete the function CountCharacters() that takes one string p
CHALLENGE ACTIVITY 301722.2037154.xxxxy7 Jump to level 1 Complete the function CountCharacters() that takes one string parameter and one character parameter. The function returns the number of characters in the string that are equal to the character parameter. Ex: If the input is zghm z, then the output is: 1 6.11.4: Functions with string parameters. 1 #include <iostream> 2 using namespace std; 3 4 int Count Characters (string inputstring, char x) { 5 y* your code goes here */ 6 01 7 8 } 9 10 int main() { 11 string inputstring; 12 13 14 15 16 17 18 char x; int result; cin >> inputstring; cin >> X; result = CountCharacters (inputstring, x); 2 3 2 3