Question
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
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