This question is about vectors. In this question you will write a program with two functions. You must also write the #include statements. In your main() function you will create two vectors which will store integers and strings respectively. After that your program must read user inputs from the console.  If the input is a string you should append it to the string vector.  If the input is an integer, you should append it to the integer vector. You cannot use the strutils library. You cannot use the prompt library. The range of the integers is [-10, 10]. If the user input exceeds this range, you should warn the user and skip that input. There are no restrictions on the string inputs. Your program should stop collecting user inputs, when the user inputs the word STOP (case-sensitive). After that point you should send your int vector as a reference parameter to a non-void function that will find the biggest sum within the vector. If the vector is empty, your function should return 0. Else if the vector is not empty, your function should return the sum of all positive values: If vector: [-5, -1, -3], return: 0 If vector: [-3, 2, 8], return: 10 If vector: [0, 4, 1], return: 5 Once this value is returned to the main() function, your program should call a second void function, which will take the string vector and the biggest sum value as parameters and find the words that are longer than the biggest sum (say bigSum). All words that are longer than bigSum should be printed onto the console on separate lines. If the string vector is empty your function should print an error message stating that the vector is empty. If the string vector has strings that are shorter than bigSum, then your function should print an error message stating that no strings were found longer than the biggest sum value. Below you can find sample runs:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

This question is about vectors. In this question you will write a program with two functions. You must also write the #include statements.

In your main() function you will create two vectors which will store integers and strings respectively. After that your program must read user inputs from the console. 

  • If the input is a string you should append it to the string vector. 
  • If the input is an integer, you should append it to the integer vector.
  • You cannot use the strutils library.
  • You cannot use the prompt library.

The range of the integers is [-10, 10]. If the user input exceeds this range, you should warn the user and skip that input.

There are no restrictions on the string inputs.

Your program should stop collecting user inputs, when the user inputs the word STOP (case-sensitive).

After that point you should send your int vector as a reference parameter to a non-void function that will find the biggest sum within the vector.

  • If the vector is empty, your function should return 0.
  • Else if the vector is not empty, your function should return the sum of all positive values:
    • If vector: [-5, -1, -3], return: 0
    • If vector: [-3, 2, 8], return: 10
    • If vector: [0, 4, 1], return: 5

Once this value is returned to the main() function, your program should call a second void function, which will take the string vector and the biggest sum value as parameters and find the words that are longer than the biggest sum (say bigSum). All words that are longer than bigSum should be printed onto the console on separate lines.

  • If the string vector is empty your function should print an error message stating that the vector is empty.
  • If the string vector has strings that are shorter than bigSum, then your function should print an error message stating that no strings were found longer than the biggest sum value.

Below you can find sample runs:

Below you can find sample runs:
Sample Run 1
Please enter new input: -11
ERROR: Integer out of range.
Please enter new input: 23
ERROR: Integer out of range.
Please enter new input: STOP
ERROR: String vector is empty.
Sample Run 2
Please enter new input: -7
Please enter new input: -5
Please enter new input: Hello
Please enter new input: 3
Please enter new input: Merhaba
Please enter new input: 4
Please enter new input: Welcome
Please enter new input: STOP
ERROR: No words are longer than 7 characters.
Sample Run 3
Please enter new input: Hello
Please enter new input: -1
Please enter new input: STOP
Please enter new input: Stop
Please enter new input: -7
Please enter new input: 2
Please enter new input: STOP
Hello
STOP
Stop
Transcribed Image Text:Below you can find sample runs: Sample Run 1 Please enter new input: -11 ERROR: Integer out of range. Please enter new input: 23 ERROR: Integer out of range. Please enter new input: STOP ERROR: String vector is empty. Sample Run 2 Please enter new input: -7 Please enter new input: -5 Please enter new input: Hello Please enter new input: 3 Please enter new input: Merhaba Please enter new input: 4 Please enter new input: Welcome Please enter new input: STOP ERROR: No words are longer than 7 characters. Sample Run 3 Please enter new input: Hello Please enter new input: -1 Please enter new input: STOP Please enter new input: Stop Please enter new input: -7 Please enter new input: 2 Please enter new input: STOP Hello STOP Stop
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY