Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, Can someone help me to write a C++ program that allows the user to search through a list of names stored in a file

Hi, Can someone help me to write a C++ program that allows the user to search through a list of names stored in a file for a particular one?

(Make sure to allow the user to tell you the name of their file and to check for file open errors.)

The names in the file will be stored one per line (spaces are allowed in the names). You won't know the length of the list of names ahead of time.

Your search must be case-insensitive.

Make sure to adequately test your program! (Empty data set, find the first item, find last item, find a few in the middle, etc.)

Don't forget to read the file's name from the user and protect your program against any errors that may occur during the opening of the file.

-----------------------------------------------------------------------------------------------------------

- Bob Smith

- Mary Jones

- Tammy Henry

- Rob Smith

----------------------------------------------------------------------------------------------------------

and a sample run might look like this:

----------------------------------------------------------------

Please enter the name of your names file: bob.dat

I'm sorry, I could not open 'bob.dat'.

Please enter another name: names

File 'names' opened successfully!

What name would you like to find in this file? tammy henry

'Tammy Henry' is the 3rd name in the file!

----------------------------------------------------------------------------------------------------------

Don't forget about when the name isn't in the file.

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Did the decisions need to be made, or had they already been made?

Answered: 1 week ago

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago