1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Minchanka [31]
2 years ago
13

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++
Computers and Technology
1 answer:
Eddi Din [679]2 years ago
5 0
#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;
}
You might be interested in
Write an algorithm for finding the perimeter of a rectangle
Svet_ta [14]
A formula could be 2a+2b
6 0
3 years ago
Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correc
NNADVOKAT [17]

Answer:

There are two ways in which programs ... count-controlled loops; condition-controlled loops ... Sometimes it is necessary for steps to iterate a specific number of times. ... A count-controlled loop is used when the number of iterations to occur is ... the variable 'count' is used to keep track of how many times the algorithm

Explanation:

5 0
3 years ago
Read 2 more answers
What is the differnces between dark and middle ages of computer?​
noname [10]
The "middle ages" are anything between the collapse of Rome (400 AD) to its re-emergence in Rennaissance Italy (1400). Rennaissance means "rebirth". The "dark ages" are the period in the middle ages which were relatively undocumented. This would definitely include 400 AD to 700 AD, and some extend it to 900 AD.
3 0
4 years ago
Do transformers have life insurance or car insurance? If you chose life insurance, are they even alive?
ladessa [460]

Answer:

Car insurance

Explanation:

they are machines with ai

4 0
3 years ago
Why are high-quality transformers wound with large diameter wire?
lesya692 [45]
So that they can lower the I2R losses
8 0
4 years ago
Other questions:
  • What is the software called that allows the user to create, access, and manage a database? question 8 options:
    10·1 answer
  • Media messages are communicated through which of the following:
    8·2 answers
  • Complete the function void update (int *a, int *b), which reads two integers as argument, and sets a with the sum of them, and b
    8·1 answer
  • 1⁰=?<br> Is equal to...........
    12·2 answers
  • The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members
    11·1 answer
  • Describe any five GSM PLMN basic services?
    10·1 answer
  • Missy loves her old Windows games. When she upgrades her Windows system, the games run fine, but the output looks fuzzy since th
    15·1 answer
  • Citing Wikipedia as a reference is not considered a good practice because 1.leverages a neutral point of view. 2.hosts unopinion
    8·1 answer
  • Yeah help me please......................
    9·1 answer
  • Write a program that takes in an integer in the range 10 to 100 as input. Your program should countdown from that number to 0, p
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!