Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming C + + using Linear Search with One Dimensional Array In this assignment, we will practice using Linear Search for a problem. Steps for
Programming C using Linear Search with One Dimensional Array
In this assignment, we will practice using Linear Search for a problem.
Steps for programming:
Write a program named books.cpp;
Copy the data file booktitles.dat into your project directory.
What to include in "books.cpp program:
The program reads the titles of a collection of books from a data file and stores them in an array.
This should be done using a User defined function named "ReadData". This function should have parameters:
the input file stream,
the array of book titles, and
the number of books read from the file.
Then, the program sorts the titles in alphabetical order use bubble sort and printsout the list of book titles, one title per line,
Afterwards, the program goes into a query mode prompting the user to query whether a book is in the collection. If the book is in the collection, it display its location in the collection. If the book is not in th collection, inform the user about that. The query mode ends when the usr enters an empty string, ie simply press the "ENTER" key when prompted for book title.
Notice: The index of the first element in the array is Yet, for the output, the value corresponding to the first book should be Same goes for the location values returned in the query mode.
Here is an example run of the program:
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