Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A lottery player bought lottery 1 0 tickets with the following numbers 1 3 5 7 9 2 4 5 7 9 3 2 9

A lottery player bought lottery 10 tickets with the following numbers
1357924579329831982378213
2987645091219077843212983
Write a program in C++ that will initialize an array (or a vector) with the numbers
of the 10 tickets bought shown above. Then prompt user to enter a 5-digits
number for the winning number.
Your job is do a linear search of the winning numbers on the array/vector that has
the numbers of the tickets bought. This linear search must be done in a function.
If the search is successful, return index where search value was found otherwise,
return -1 if value sought is not the array. You must have a function that will
accept the array and return where winning numbers were found. Return -1 if not
found.
Test program to make this is working.
Then add a sort() function to sort the array above and the a binarySearch()
method to search for the winning numbers in the array already sorted. Return
where the winning numbers was found if found, else return -1

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

Understand the principles of a learning organization.

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago