Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pascal Programming Program 3: President records The president file contains records in the form of text lines, one per U.S. president. Each president record contains:
Pascal Programming
Program 3: President records The president file contains records in the form of text lines, one per U.S. president. Each president record contains: The president's 3-digit ID The president's first name The president's last name One or more blanks separate the ID and the last and first names. There are no blanks inside the names The records are already sorted by ID. You do not know in advance how many president records there are. The last president record is followed by a dummy record that has 0 in place of the ID Read and store each president's ID, first name, 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 ID numbers. For each ID, search and find the matching president. Input data 23 John Kennedy 172 Lyndon Johnson 265 Richard Nixon 306 Gerald Ford 497 Jimmy Carter 500 Ronald Reagan 668 George Bush 701 Bill clinton 888 Barack Obama 939 Donald Trump 497 123 666 888 Output After reading in the presidents and storing them in an array of records, print the array. Then for each ID, search the array for the matching president and print that president's first and last name. If there is no match, print no match
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