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

the energy needed for the changes in the water cycle to take place comes from A: Wind B: Green Plants C: Nitrogen D: The sun
what is the measure of an exterior angle of a regular 7-sided polygon?
Which court is the federal court of original jurisdiction' U.S. District Court State-level criminal court State Supreme Court U.S. Courts of Appeal
find x and y from the following? 2x+3=y+6 -4x-12=-8y
A manufacturer determines that the cost of making a computer component is ​$3.252525. Write the repeating decimal cost as a fraction and as a mixed number. Th
convert meters to nanometers
How do you find the value of 4!
If Somethingis a conductor is it a metal
HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
Why are members of this domain called archaea which comes from the Greek world for ancient