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]
3 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]3 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 information should be included in the closing paragraph of a thank-you letter? a. Mention skills that were omitted during t
stiks02 [169]
The answer is c and sorry for being so rude I didn't realize it was you girly

3 0
4 years ago
Read 2 more answers
Keira is using the software development life cycle to create a new app. She has the pseudocode for her program. Which stage of t
kodGreya [7K]

Keira is using the software development life cycle to create a new app. She has the pseudocode for her program. The next stage for Keira is CODING.

Explanation :

  • SDLC or the Software Development Life Cycle is a process that produces software with the highest quality and lowest cost in the shortest time. SDLC includes a detailed plan for how to develop, alter, maintain, and replace a software system.
  • SDLC involves several distinct stages, including planning, design, building, testing, and deployment. Popular SDLC models include the waterfall model, spiral model, and Agile model.
  • The steps of the SDLC are given below :
  • Identify the current problems. “What don’t we want?”
  • Plan. “What do we want?”
  • Design. “How will we get what we want?”
  • Build. “Let’s create what we want.” This SDLC stage develops the software by generating all the actual code. If the previous steps have been followed with attention to detail, this is actually the least complicated step.
  • Build is the phase which Keira should move onto in the SDLC
  • SDLC done right can allow the highest level of management control and documentation. Developers understand what they should build and why. All parties agree on the goal up front and see a clear plan for arriving at that goal. Everyone understands the costs and resources required.
7 0
3 years ago
Read 2 more answers
I dont uderstand dis my teacher no helping pls help me i need to understand TEch
Anna11 [10]

Answer:

IO S  = Apple

And roid = Goo gle

Sym bian = Montrola

Black Berry = R I M

Explanation:

7 0
3 years ago
Keeping memos on your checks is important because they
Anastasy [175]

Answer: they can determine how you get paid, so if you get a memo about schedules, and you work hourly, you keep keep that memo to show that you are following direction in hours, which result in getting paid more/less.

8 0
3 years ago
What is the famous saying among computer programmers?
USPshnik [31]
The famous saying is garbage in , garbage out .
3 0
4 years ago
Other questions:
  • loop Write a program to read a list of exam scores given as integer percentages in the range 0 to 100. Display the total number
    5·1 answer
  • Convert 234.43 (base 7) to base 10
    7·1 answer
  • Like Tess, Brina has a fascinating job! She works as a software engineer with Instagram. She says that Computer Science is a way
    10·2 answers
  • Can you give me a long list of kid's cartoons
    8·2 answers
  • Consider the eight bit signed binary number 1110 0101. Convert it to signed decimal from assuming the signed binary number is re
    5·1 answer
  • EVERYONE PLS JOIN MY GOOGLE CLASSROOM<br> CODE: clmvjbd
    13·2 answers
  • What is Accenture's role in Multi-party Systems?
    12·1 answer
  • How to be gud at Friday night funk
    11·1 answer
  • Algorithm to print the first 10 odd numbers​
    10·1 answer
  • In a stack, if a user tries to remove an element from an empty stack it is called.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!