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

Under the new securities rules issued under the JOBS Act, which of the following companies would need to register its securities under the 1934 Securities Excha
There is good evidence in some species that testosterone does not masculinize the brain directly, that it is first converted to estradiol, which then masculiniz
Daniel sold half of his comic books and then bought sixteen more . He now has 37 . With how many did he begin
please solve with explanation
Cumulative Preference stockholders receive $.90 per share. There are 40,000 shares. For the last four years no dividends have been paid. This year $170,000 is p
The money supply falls from $1,200 billion to $1,160 billion. According to the simple quantity theory of money, the price level will decline by __________ perce
whats the 3 step of appointment confirmation ​
which of the following produce an a cute angle
An unknown substance weighing 0.545g is placed into a bomb calorimeter with a heat capacity of 6.75 kJ/°C. When the sample is burned completely, the temperature
How do you divide ratios that are uneven?