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
to move from the second cell in the table in the accompanying figure back to the previous cell, press the ____ key(s)
Serhud [2]
I believe the answer is Shift + Tab
8 0
3 years ago
How to send an email to multiple recipients individually.
zheka24 [161]

Answer:

The BCC method

Explanation:

4 0
2 years ago
Clicking on the cube that appears in the top right of the 3D view window will: (1 point)
german

Answer:

The correct option is;

Toggle between orthographic and perspective views

Explanation:

On a game design program such as Unity 3D, when the cube with colored pointers that can be located on the 3D view window is clicked, it will bring about a switch between the perspective or 90 degrees and orthogonal views which enables the display of the object in three dimension that appears more like real life figures.

5 0
3 years ago
1 punto
masya89 [10]

Answer:

Retailing.

Explanation:

La venta al por menor o retailing es el suministro de bienes físicos a los consumidores para uso personal, sea en pequeña o grandes cantidades, siempre que esté destinado a consumidores finales. Es un sector que consta de diferentes ramas (como la industria alimentaria, la industria de la moda, la industria del mobiliario para el hogar, etc.). El comercio minorista es el último eslabón de la cadena de suministro que va desde el fabricante hasta el consumidor.

4 0
3 years ago
Can someone please tell me what I’m doing wrong ? Please and it’s due on Thursday!!
liberstina [14]

Answer:

Sure. In Unit test 5, it's looking for 1 instead of 0. You are returning 0 instead of 1.

0 requires 1 digit to express it and should therefore return 1.

In line 6, change the 0 to a 1.

8 0
2 years ago
Other questions:
  • A cell reference that has only one $ is referred to as a(n) ____ cell reference. alternative mixed relative absolute
    7·1 answer
  • To select all the text in a document, press ____.
    12·2 answers
  • _____ is defined as an attraction for a source based on a resemblance between the source and receiver of a message.
    15·1 answer
  • In C, developers may access arrays via bracketed syntax like Java or by using * dereferencing notation. The following assignment
    5·1 answer
  • When a person or organization uses the services of another professional, that person or organization is called the _______
    15·1 answer
  • HELP 99PTS If Answered
    12·2 answers
  • ______ is/are the replacement of human operation and control of machinery with some form of programmed control.
    11·1 answer
  • Write a program to accept 10 different whole number from the user and store them in a
    11·1 answer
  • Which of the following candidates would most likely be hired as a graphic artist?
    15·2 answers
  • The complete process for learning through repetition is to read, write, say, rest and revisit the information. Please select the
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!