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
Why do designers of smartphones hide computer processing details from
geniusboy [140]

Answer:

b.you can focus on otherthings

6 0
2 years ago
Read 2 more answers
Gary frequently types his class assignment. His ring automatically types the letter O. What is Gary using when he types?
Solnce55 [7]
The answer would be C
8 0
4 years ago
Read 2 more answers
Why is there so much stuff popping up on my computer task manager
Morgarella [4.7K]

Answer:

Honestly there could be a number of reasons

Explanation:

could be that you have a virus.

could be unfinished tasks

there's really  lot of reasons this could be happening.

I suggest if its your browser task manager to reset your browser (via browser settings)

If its the system task manager, i suggest trying to restart the computer and go from there.

depending on the root of your problem, it may work, it may not.

Hope this helps :P

7 0
3 years ago
What are the benefits of building redundancy into a network? What are the potential issues with building redundancy?
dusya [7]

Answer: Network redundancy can be defined as the process of adding the network device, along with a line of communication to provide network availability.

Explanation:

Benefits of building redundancy into a network: It decreases the risk of network failure.

If one server fails to transfer the information, then the backup server will take the charge to help in continuing the communication.

Potential issues with building redundancy: Denial of service and cyber attacks are the threats to network.

Without the use of backup system the one point failure can disrupt the entire system.

8 0
3 years ago
A statement or account giving the characteristics of someone or something is called?​
vredina [299]

a statement or account giving the characteristics of someone or something is called <u>description.</u>

I hope it's help ^^

7 0
2 years ago
Other questions:
  • Press the enter key in all of the following circumstances except _____.
    12·1 answer
  • What is the device called which typically combines the capabilities of a scanner, printer, fax, and copying machine?
    15·1 answer
  • If num is an int which expression always evaluates to true if num holds an odd number
    15·1 answer
  • Learning in a digital environment is also called learning.
    6·2 answers
  • Which item is most likely to be a standard part?
    14·1 answer
  • If i took my SIM card out of my phone and put it in a router then connect the router and my phone with Ethernet cable would the
    12·1 answer
  • Why does each record need a unique ID number?
    5·2 answers
  • Write a method, including the method header, that will receive an array of integers and will return the average of all the integ
    7·1 answer
  • Let f(w) = 2w^3 - 5. Let z = 2. What is f(z)?​
    6·1 answer
  • (Print distinct numbers) Write a program that reads in integers separated by a space in one line and displays distinct numbers i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!