Question: Reading record from a text file into array in Pascal Code Input file presidents.txt contains records in the form of text lines, one per U.S.

Reading record from a text file into array in Pascal Code

Reading record from a text file into array in Pascal Code Input

file presidents.txt contains records in the form of text lines, one per

Input file presidents.txt contains records in the form of text lines, one per U.S. president. Each president record contains: The starting year of the president's term (4 digits) The ending year of the president's term (4 digits) The president's first name The president's middle initials with periods (not all presidents have middle initials) The president's last name One or more blanks separate the years and the first and last names and middle initials. There are no blanks inside the first and last names. If a president has more than one initial, they are written together with periods but no blanks. You must assume that the presidents not sorted. Your program should not know in advance how many president records there are. The last president record is followed by a sentinel record that has -1 in place of the starting year. Read and store each president's years, first name, middle initials (if any), and last name in a Pascal record. Store all the records in an array of records that's large enough to hold 20 records. Following the dummy record, there is a list of search years terminated by -1. For each search year, find the president who was in office during that year (there may be more than one president). Input file presidents.txt contains records in the form of text lines, one per U.S. president. Each president record contains: The starting year of the president's term (4 digits) The ending year of the president's term (4 digits) The president's first name The president's middle initials with periods (not all presidents have middle initials) The president's last name One or more blanks separate the years and the first and last names and middle initials. There are no blanks inside the first and last names. If a president has more than one initial, they are written together with periods but no blanks. You must assume that the presidents not sorted. Your program should not know in advance how many president records there are. The last president record is followed by a sentinel record that has -1 in place of the starting year. Read and store each president's years, first name, middle initials (if any), and last name in a Pascal record. Store all the records in an array of records that's large enough to hold 20 records. Following the dummy record, there is a list of search years terminated by -1. For each search year, find the president who was in office during that year (there may be more than one president)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!