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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started