Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use c++ and explain code. thanks Question 6: In this question, you will write two versions of a program that reads from the user a

image text in transcribeduse c++ and explain code. thanks

Question 6: 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 100 OOI ON OO Please enter a number you want to search: 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. Implementation requirements (for both programs): 1. Think how to break down your implementation to functions. 2. Your programs should run in linear time. That is, if there are n numbers in the input sequence, your program should run in O(n). 3. Write the two programs in two functions named main1 () and main2 (). Also have the main () test these two functions

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

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions