Write a program that will perform sorting and searching across records stored in a file. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that will perform sorting and searching across records stored in a file. The program should first query the user for a filename. The program should open the file and read the first entry. It defines the number of records in the file. The program should read each record and store it into memory. Each record in the file will have sets of three lines. Each set consists of: lastname, firstname, and birthdate. Your program should prompt the user for a command: Searching - The user should be able to supply a search value and your program should print any entries that start with that value. You should search all first names, last names, and birthdates. There may be multiple values returned. Sorting - The user should be able to choose to print the data in its original unsorted form, sorted by first name, or sorted by last name. Quit – Exit the program Code must be well commented. Write a program that will perform sorting and searching across records stored in a file. The program should first query the user for a filename. The program should open the file and read the first entry. It defines the number of records in the file. The program should read each record and store it into memory. Each record in the file will have sets of three lines. Each set consists of: lastname, firstname, and birthdate. Your program should prompt the user for a command: Searching - The user should be able to supply a search value and your program should print any entries that start with that value. You should search all first names, last names, and birthdates. There may be multiple values returned. Sorting - The user should be able to choose to print the data in its original unsorted form, sorted by first name, or sorted by last name. Quit – Exit the program Code must be well commented.
Expert Answer:
Answer rating: 100% (QA)
include include include include using namespace std Class Person definition class Person private Dat... View the full answer
Related Book For
Artificial Intelligence A Modern Approach
ISBN: 978-0137903955
2nd Edition
Authors: Stuart J. Russell and Peter Norvig
Posted Date:
Students also viewed these programming questions
-
Your task is to write a program that will sequentially print the command line arguments to a program, with each argument on a new line. If no arguments have been provided, print this message and exit...
-
Write a program that receives an ASCII code (an integer between 0 and 127) and displays its character. For example, if the user enters 97, the program displays the character a. Here is a sample run:...
-
Write a program that will take as input two Web page URLs and find a path of links from one to the other. What is an appropriate search strategy is bidirectional search a good idea? Could a search...
-
About "Hilton Honors" 1) Explain what creates value and identify if there are aspects that do not create value. (Please include the citation and references) 2)What is the strength of the Hilton Honor...
-
Using Manchester encoding, encode the bit pattern 01001110.
-
Consider a project with free cash flows in one year of $130,000 or $180,000, with each outcome being equally likely. The initial investment required for the project is $100,000, and the projects cost...
-
What performance measure would you consider most important for McDonald's? For Chevrolet?
-
Presented below is information related to Rembrandt Inc.s inventory. Determine the following: (a) The two limits to market value (i.e., the ceiling and the floor) that should be used in the...
-
When switch S is thrown to the left in figure, the plates of capacitor 1 acquire a potential differenceVo. Capacitors 2 and 3 are initially uncharged. The switch is now thrown to the right What are...
-
The steam cycle of a marine nuclear propulsion plant may be modeled as an ideal Rankine cycle. a . Using the information provided below determine the enthalpy of the working substance in each state....
-
Answer the following questions: 1. Legal drafting generally requires attorneys to think outside the box and ask the worst-case-scenario-type questions. What happens if? Assume you have a young couple...
-
A small charge q = 0 . 5 = 0 . 5 nC is placed distance 2 . 0 2 . 0 cm away from a stationary charge Q = 9 . 5 = 9 . 5 nC . . At that spot charge q experiences acceleration of magnitude 1 0 0 1 0 0 m...
-
9. A real number x is defined to be a rational number providedthere exist integers m and n with n does not equal 0 such that x=m/n. A real number that is not a rational number is called anirrational...
-
Below is a portion of the amortization table related to the issuance of 20-year bonds from Zeroz Company (YOU DO NOT NEED TO COMPLETE THE TABLE). The bonds were issued on January 1, 2004. The bonds...
-
Your bank offers you a $10,000 line of credit with an interest rate of 2 percent per quarter. The loan agreement also requires that 4 percent of the unused portion of the credit line be deposited in...
-
(5 points) Pease's Candy Shop has ten different kinds of chocolate bars: four kinds of milk chocolate, three kinds of dark chocolate, and three kinds of white chocolate. Li is going to buy six...
-
which area of management includes laying proper guidelines for taking proper care and maintenance of machinery? O Maintenance management O Workforce management O Employee management O Machine...
-
An investor sells a European call on a share for $4. The stock price is $47 and the strike price is $50. Under what circumstances does the investor make a profit? Under what circumstances will the...
-
How much is a micro-mort worth to you? Devise a protocol to determine this. Ask questions based both on paying to avoid risk and being paid to accept risk.
-
This exercise concerns grammars for very simple languages. a. Write a context-free grammar for the language anbn. b. Write a context-free grammar for the palindrome language: the set of all strings...
-
Suppose that a training set contains only a single example, repeated 100 times. In 80 of the 100 cases, the single output value is I; in the other 20, it is 0. What will a back- propagation network...
-
______________ occur(s) when the speaker should pause but instead fills the silence (umm, ahh).
-
Identify an election (federal, state, or local) for which a debate was broadcast. Analyze how the different speakers were able to adapt their messages based on the moderators questions and their...
-
___________ refers to your credibility as a presenter as well as the credibility of the information delivered in your presentation.
Study smarter with the SolutionInn App