Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this question, you will write two versions of a program that reads from the user a sequence of positive integers ending with -1, and

In this question, you will write two versions of a program that reads from the user a sequence of positive integers ending with -1, and another positive integer num that the user wishes to search for. The program should then print all the line numbers in sequence entered by the user, that contain num, or a message saying that num does not show at all in the sequence.

Your program should interact with the user exactly as it shows in the following example:

Please enter a sequence of positive integers, each in a separate line. End you input by typing -1.

13

5

8

2

9

5

8

8

-1

Please enter a number you want to search. 5

5 shows in lines 2, 6.

a) The first version of the program, is not allowed to use the vector data structure.

b) The second version of the program, should use the vector data structure.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

What are the two common questions about money? AppendixLO1

Answered: 1 week ago