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
sineoko [7]
3 years ago
13

Write the definition of a function named count that reads all the strings remaining to be read in standard input and returns the

ir count (that is, how many there are) So if the input was:
hooligan sausage economy
ruin palatial
the function would return 5 because there are 5 strings there.
Computers and Technology
1 answer:
spayn [35]3 years ago
8 0

Answer:

The function written in C++

int str(string word) {

int count = 1;

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

 if(word[i] == ' ') {

  count++;

 }

}

return count;

}

Explanation:

This line defines the function

int str(string word) {

This line initializes count to 1

int count = 1;

This line iterates through the input string

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

This line checks for blank space

 if(word[i] == ' ') {

Variable count is incremented to indicate a word count

  count++;

 }

}

return count;

}

<em>See attachment for full program</em>

Download cpp
You might be interested in
Which one is the answer for the question.
masya89 [10]

Answer:

if/else statement

Explanation:

If the condition specified in the if statement is true, the block of code at the if statement is run. If not, the code at the else statement is run.

8 0
3 years ago
What type of error results from an error in the formatting of the program code?
NNADVOKAT [17]
I believe the answer is a syntax error. For example, in java if a semicolon is missed, a syntax error will be produced because the code cannot compile.
5 0
3 years ago
Which column and row references are updated when you copy the formula: =F$5+12? Value 12 Column F Column F and row 5 Row 5
NemiM [27]
The answer is column F. During relative copy and paste in Excel, the positioning of the '$' symbol effectively indicated an absolute reference to a position, so that is not updated. Therefore, in the formula '<span>=F$5+12</span>', only column F is updated. 
8 0
4 years ago
Write a program that converts or calculates values. Use the following guidelines to write your program:
Setler [38]

Answer:

In Section 2.2 “Expressing Units”, we showed some examples of how to ... with other units of the same type to get a numerical value that is easier to comprehend. ... The rules of algebra say that you can change (i.e., multiply or divide or add or ... We see that one-half of a yard equals 3/2, or one and a half, feet—something Explanation:

8 0
3 years ago
Need help with this file and due today!!
BARSIC [14]
I can’t see the picture
7 0
3 years ago
Other questions:
  • All of the following are stages in the SDLC except _____.
    9·1 answer
  • List and define the types of System Software. How does System Software differ from Applications Software?
    12·1 answer
  • HELP PLEASE
    7·2 answers
  • Criminal Investigation people called my house on an automated voice is this a scam ??
    13·1 answer
  • PLEASE HURRY
    6·1 answer
  • What part of the computer gives access to the internet
    10·1 answer
  • Explain the use of keyboard shortcuts and key combinations. You are at the tenth page of a 20-page document. You need to make ch
    14·1 answer
  • What is the use of technology to enable people to learn anytime and anywhere​
    13·1 answer
  • What two windows security updates do most organizations always patch?
    7·1 answer
  • What does a hanging indent look like?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!