paulrai238 paulrai238
  • 09-12-2021
  • Computers and Technology
contestada

Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string in c++

Respuesta :

Talanat
Talanat Talanat
  • 09-12-2021
#include
#include

using namespace std;

int CountCharacters(char userChar, string userString){
int result = 0;
for(int i = 0;i if(userString[i] == userChar){
result++;
}
}
return result;
}

int main(){
string userString;
char userChar;
cin>>userChar>>userString;
cout< return 0;
}
Answer Link

Otras preguntas

If you add 5 to me and then divide by 9, you get3. What number am I
Which Latin root does abundant come from?
Write an expression that can be used to find 4 x 275 using mental math and properties of numbers.
Which is not a property of light
How do particle collisions transfer energy? How does conduction transfer heat in solids? What is a conductor? What is an insulator? Convection? What is density?
(4m^4-m^2)+(5m^2+m^4)
Can 21/44 be simplified
Why does Scrooge ask the charity men whether the prisons and workhouses are still available to the poor? A. In Scrooge's time, the poor are treated with great c
All multicellular organisms benefit from the organization of __________ into tissues, organs, and organ systems.
A ______________ generally uses a form of the verb “to be” in a comparison of two unlike things. a. simile c. analogy b. metaphor d. idiom
good job