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

Most amino acids require______.
Which two types of waves can transmit energy through a vacuum? 1.radio waves 2.seismic waves 3.sound waves 4.water waves 5.x-rays
if we call aliens, aliens on our planet then would we be called aliens on theirs
(x + 3) (x + 5) (x + 7) (x + 9) + 16​
Which change to the chromosome causes Robertsonian translocation? part of the chromosome breaks off, causing missing genes on the chromosome movement of genes o
HELP! Being TIMED Based on the scatter plots, which type of model is most suitable for estimating the stock price?
In a command economy, people are not free to
Which argument is a non sequitur fallacy?
please answer, much appreciated!!!!!
2-53. a message is released at 1930 hours greenwich mean time on 2 january 1991. what is the correctly stated date-time group (dtg) assigned to the me