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
ddd [48]
2 years ago
14

c++ 4.17 LAB: Count characters 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. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. Ex: If the input is: n Monday the output is: 1 n
Computers and Technology
1 answer:
Nata [24]2 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main() {

   int n = 0;

   char c;

   string str;

   cin >> c >> str;

   for (int i = 0; i < str.length(); ++i)

       if (c == str[i]) n++;

   cout << n << " n" << (n > 1 ? "'s" : "");

   return 0;

}

Explanation:

Declares variables n, c, and str.

Next a loop lets count number of character c in string str.

Finally, answer is showing.

You might be interested in
List out two ways to execute the script.​
castortr0y [4]

Answer:

1) Execute Shell Script Using File Name. Use the shell script file name to execute it either by using it's relative path or absolute path as shown below

2) Execute Shell Script Using Source Command.

7 0
3 years ago
Read 2 more answers
In the retrieval phase of Godden and Baddeley (1975) study of the encoding specificity principle, participants were asked to sup
kicyunya [14]

Answer:

recall

Explanation:

Based on the scenario being described within the question it can be said that this was a recall measure of memory. In the field of neuroscience, a recall test refers to a type of test in which subjects are shows a certain stimuli and are later asked to remember as many stimuli as they can. Which in the case of the Godden and Baddeley (1975) study the stimuli were a set of words that were shown to the subjects.

5 0
3 years ago
What are the steps to configure user information in a document?
chubhunter [2.5K]

Answer:

file, properties, options, general

Explanation:

4 0
3 years ago
Read 2 more answers
Why is body language an important indicator in business meetings? A. You will be able to communicate more strongly. B. You will
pantera1 [17]

Answer:

you will know if your audience is engaged.

Explanation:

6 0
3 years ago
Which of the following types of servers can be used to cache requested Internet resources so that they can be more quickly deliv
omeli [17]

Answer:

Proxy Server

Explanation:

  • Proxy server is a server that acts as a mediator between two systems.
  • One system can be your computer and the other can be the server to which you are asking a service, such as requesting a web page.
  • Lets suppose you request a web page from a server and you type a URL of a website to access a web page.
  • This request goes to proxy server which sends this request on your behalf to the target server in order to retrieve that web page.
  • Proxy server makes this request to the target server on the internet by using one of its IP addresses.
  • When the proxy server gets that web page, it will forward that web page to your requesting computer.
  • If you request a specific service such as a website frequently the proxy server saves that website on its cache.
  • So if you request that website again, proxy server will forward it to you from its cache rather than requesting it again from the target server on your behalf resulting in quick response to the user's request. This speeds up the delivery of resources to the users.
  • Proxy servers provide users with privacy to access the websites, and they can surf the internet anonymously .
8 0
3 years ago
Other questions:
  • Create an integer variable named ‘listSize’ and initialize the value to 1000.
    5·1 answer
  • Which encryption standard goes with the WPA2 protocol?<br> AES<br> DES<br> TKIP<br> WPS
    10·1 answer
  • Professionalism is defined as what?<br> ASAP PLEASE!
    11·1 answer
  • Which bus slot provides the highest video performance​
    8·1 answer
  • You manage a small LAN for a branch office. The branch office has three file servers and few client workstations. You want to us
    14·1 answer
  • What is drop shipping and how it works on amazon?
    12·1 answer
  • What gaming PC should I get
    14·2 answers
  • Block elements start a new line when rendering? (true or false)
    7·1 answer
  • Why would a programmer use a flow chart? (Edge2020 Coding Critical Thinking Questions)
    9·1 answer
  • Which of the following are acceptable to share? Check all of the boxes that apply.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!