Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!