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
Ghella [55]
2 years ago
14

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.
Ex: If the input is:

n Monday
the output is:

1
Ex: If the input is:

z Today is Monday
the output is:

0
Ex: If the input is:

n It's a sunny day
the output is:

2
Case matters.

Ex: If the input is:

n Nobody
the output is:

0
n is different than N.





This is what i have so far.
#include
#include
using namespace std;

int main() {

char userInput;
string userStr;
int numCount;

cin >> userInput;
cin >> userStr;

while (numCount == 0) {
cout << numCount << endl;
numCount = userStr.find(userInput);

}
return 0;
}
Computers and Technology
1 answer:
nevsk [136]2 years ago
5 0
Here is a Python program:

tmp = input().split(' ')
c = tmp[0]; s = tmp[1]
ans=0
for i in range(len(s)):
if s[i] == c: ans+=1

# the ans variable stores the number of occurrences
print(ans)
You might be interested in
What is a browser? Give one example
Harman [31]
It is a program that may be used by a user to access files and navigate the World Wide Web. An example of this would be Firefox, Chrome, Safari, etc.
3 0
2 years ago
Read 2 more answers
Small-business owner Marcos set up his Google Ads campaign by thinking of “obvious” keywords off of the top of his head. What's
LiRa [457]

Answer:See the suggestions on the Opportunities tab

Explanation: The improvement in the Google ad can be made by the taking a look at the Opportunities tab which will display the adequate opportunities.

The tab displays these opportunities on the basis of the campaign settings, account's history, performance, style, trends etc and thus will create the appropriate opportunities accordingly.Thus Marcos will have to see the suggestion displayed on Opportunities tab

5 0
3 years ago
What is the average time a caller waits for an operator to answer?
kaheart [24]
3-4 minutes is about right is say
7 0
3 years ago
Which of the following would you use to search a table in Excel?
snow_tiger [21]

Answer:

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are empty</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNT</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTA</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTAc. COUNTBLANK</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTAc. COUNTBLANKd. COUNTVALUES</em>

3 0
2 years ago
Read 2 more answers
Pls help!!
alexira [117]

Answer:

4.24

Explanation:

First you find the mean of the data set, which is 7. Then to find standard deviation you have to follow the formula which tells you to subtract the mean from each number under the square root : √(2 - 7)^2 + (9 - 7)^2 + (10 - 7)^2 + (4 - 7)^2 + (8 - 7)^2 + (4 - 7)^2 + (12 - 7). Once you solve the parenthesis you square it, once you square it the negatives won't matter. That will leave you with this : √(25 + 4 + 9 + 9 + 25). The formula tells you to find the sum of those numbers (which is 72) then subtract one from how many numbers there are, 5 - 1 = 4, and divide your sum by that number. So 72 / 4 = 18. Then you find the square root of 18 and that becomes your answer.

7 0
2 years ago
Other questions:
  • When people need information, they typically turn to:
    7·1 answer
  • Pros and cons of Processor Throttling or Scaling?
    13·1 answer
  • Cleaning the keyboard is the most important part of keeping your computer running at peak performance.
    5·2 answers
  • What is the time period of 1st generation of computer ???
    11·1 answer
  • Is ubisoft still making assassins creeds on xbox 360
    8·2 answers
  • Which of the following is most likely to be considered plagiarism? a. Intentionally reporting the results of inaccurate statisti
    11·1 answer
  • The graph shows that sixty-eight percent of students think cyberbullying is a problem. One hundred human stick figures are shown
    14·2 answers
  • Which of the following pathways is related to Agriculture, Food, and Natural Resources?
    14·1 answer
  • Which text features does this section contain? Check all that apply.
    15·1 answer
  • If the three operations were combined, O(logN) + O(N) * O(logN) + 1, the overall algorithm cost would be:________
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!