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]
3 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]3 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
Can anybody please help me with 7.4.7 spelling bee codehs?
Eddi Din [679]

Answer:

What are you trying to say?

Explanation:

7 0
3 years ago
A certain computer has a 4meg address space. how many bits wide is this computer's address bus?
PIT_PIT [208]
22 bits






-----------------------------------
4 0
3 years ago
What percentage of jobs work in the entertainment industry?
Masja [62]
Your answer is A hope this helps
6 0
3 years ago
The Mobile Agricultural Machinery and Equipment Coverage Form does not include coverage for:__________.
satela [25.4K]

Answer:

  • Aircraft, watercraft, their equipment or  parts; automobiles; dealers'  demonstration equipment, machinery and vehicles; dirt bikes, house trailers, mobile homes, mopeds, motorcycles, motorized bicycles or tricycles, snowmobiles, trucks, vehicles primarily designed and licensed for road  use (other than wagons and trailers designed for farming purposes and used principally on the insured location);
  • Barn cleaners, boilers, bulk feed tanks or  bins, bulk milk tanks, pasteurizers or any  permanent fixtures attached to or within a building; c. Cotton pickers, harvester-thresher combines and four-wheel all-terrain vehicles not specifically declared and described in the  Declarations with a Limit of Insurance for  each item;
  • Irrigation equipment; or
  • Contraband, or property in the course of  illegal transportation or trade.

Explanation:

  • Aircraft, watercraft, their equipment or  parts; automobiles; dealers'  demonstration equipment, machinery and vehicles; dirt bikes, house trailers, mobile homes, mopeds, motorcycles, motorized bicycles or tricycles, snowmobiles, trucks, vehicles primarily designed and licensed for road  use (other than wagons and trailers designed for farming purposes and used principally on the insured location);
  • Barn cleaners, boilers, bulk feed tanks or  bins, bulk milk tanks, pasteurizers or any  permanent fixtures attached to or within a building; c. Cotton pickers, harvester-thresher combines and four-wheel all-terrain vehicles not specifically declared and described in the  Declarations with a Limit of Insurance for  each item;
  • Irrigation equipment; or
  • Contraband, or property in the course of  illegal transportation or trade.

3 0
3 years ago
Proxy download for school
netineya [11]
You have to go to an unblocked proxy server online and those ar really hard to find and i dont know any off the top of my head 
5 0
3 years ago
Read 2 more answers
Other questions:
  • Which is a network of devices built around a person, typically within 10 meters of range?
    5·1 answer
  • Which is the most visual social media site?
    6·1 answer
  • The students of a college have to create their assignment reports using a word processing program. Some of the questions in thei
    5·2 answers
  • ____ is an act, directed at Web sites catering to children, that requires site owners to post comprehensive privacy policies and
    5·1 answer
  • escribe and explain at least three improvements you think came about with the introduction of intrusion prevention technology. J
    10·1 answer
  • I will mark you Brainliest if you could guess how old i am :3
    9·1 answer
  • What is the smallest amount of information called?
    13·2 answers
  • Is there anything I can do to fix my laptop? It is a chrome book and my school provided it. Everything is still working.If anyon
    14·2 answers
  • What are placeholders in Java?
    8·1 answer
  • You have two identical print devices that are set up in a work room. Currently, the Windows print server has two printers config
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!