Terminate the linked list properly

Assignment Help Data Structure & Algorithms
Reference no: EM13317365

Cr-z-a.te a program that uses a linked list to keep track of the US Presidents.

We have a data the which contains the last name, followed by "other" names ()leach US President, in order. along with the date each took office and the date each left office. By "other" names is meant first or first plus middleks).

Define a struct which has exactly 5 variables that, for one person, will hold the last name, the "other" names. the-year-took-office. the-yew-left-office, and a pointer. The pointer will be used to point to the next set of data. for the next person.

_Arrange r our links so that you have first George Washington, then John Adams. then Thomas Jefferson,etc.

Make sure you terminate the linked list properly.

In your program. read all this data from the file (use a loop) and store it in a linked list. The pointer stored with each President should point to the next President's struct variable.

Then have your program print out these words "The United States Presidents, and the number of years they held office." Move the cursor down to the next line.

Then use the linked-list pointers to step through the list (using a loop) and print out the "other" names (containing whatever spaces they had originally) followed by a space followed by the last name of each person and after the person's name the number of years they were in office (this is a value calculated in your program). So the output has one President per line. Use setw() so that the number-of-years-in¬office are all lined up in a column, right-aligned. For the one still in office print after the name, "Currently in office."

Look at the data file before you start to plan your program. You may test specifically for Van Buren, the only president with a space in his last name, but otherwise do not tailor your program for specific data entries. Make the program general to handle all the data. Do not make any changes in the data tile.

Reference no: EM13317365

Questions Cloud

What is the frequency of this system : The maximum speed of a 4 kg mass attached to a spring is 0.68 m/s, and the maximum force exerted on the mass is 12 N. What is the frequency of this system
Calculate the pressure in the constriction in a pipe : When 0.3 m^3/s water flows through a 150 mm constriction in a 300 mm horizontal pipeline, the pressure at a point in the pipe is 345 kPa, and the head loss between this point and the constriction is 3 m.
When the fire truck is at rest : A fire truck siren produces a steady single tone of frequency 500 Hz when at rest. When the fire truck is at rest
Determine flow rate into or out of each reservoir : Three reservoirs are connected by three pipes with hA = 100 f t, hB = 20 f t, hC = 0 f t, l1 = 1000 f t, l2 = 500 f t, l3 = 400 f t and D1 = D2 = D3 = 1 f t. Determine flow rate into or out of each reservoir if friction in each pipe is 0.02.
Terminate the linked list properly : Define a struct which has exactly 5 variables that, for one person, will hold the last name, the "other" names. the-year-took-office. the-yew-left-office, and a pointer. The pointer will be used to point to the next set of data. for the next perso..
Determine the reaction of the rocker b on the beam : Determine the horizontal and vertical components of reaction at the pin A and the reaction of the rocker B on the beam. a)Determine the horizontal and vertical components of reaction at the pin A
What is the orbital speed of the second satellite : A satellite is in a circular orbit around an unknown planet. The satellite has a speed of 1.70 104 m/s, and the radius of the orbit is5.00 106 m. What is the orbital speed of the second satellite
List the things you changed and the purpose of changing it : For readability, all variable names were changed to start with a lowercase letter (e.g. VerbList was changed to verbList) and all function names were changed to start with a uppercase letters
Corporate goals-objectives for coping with unionization : Which of the following is required by most unions and is often waived for workers who become members following a successful organizing drive? Many employers have corporate goals and objectives for coping with unionization and

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Irected graph g = (v,e) in which edges that leave the source

Suppose that we are given a weighted, directed graph G = (V,E) in which edges that leave the source vertex s may have negative weights, all weights are nonnegative, and there are no negative-weight cycles. Argue that Dijkstra's algorithm correctly fi..

  Writing a java program

The history teacher at your school requires help grading a True or False test. The students' IDs and test answers are stored in a file document.

  Design algorithm based on bfs that colors a graph

Design an algorithm based on BFS that either colors a graph with 2 colors or determines that two colors are not sufficient.

  Solving single source shortest paths problem

Here is a proposed algorithm to solve single source shortest paths problem in a weighted directed graph G with possibly negative edges weights.

  How the regular tree walk algorithm works

We know how the regular tree walk algorithm works. If you have some values in the tree then the tree walk algorithm prints everything in order

  Data structures for a single algorithm

Data structures for a single algorithm

  Server of local hospital to support remote access

Explain the file system that will be installed in the server of your local hospital to support remote access of data through the hospital's doctors while they are using their mobile equipments such as cellular phones or PDAs.

  Describe open source and proprietary databases

Describe open source and proprietary databases. What are some drawbacks and benefits of each type of database?

  Identifying the location of rubric objectives

Code Comments are used to identify the location of rubric objectives, Code Formatting is used to raise the readability of the HTML Code.

  Advantage of fast running time of insertion sort

Running time of quicksort can be enhanced in practice by taking advantage of fast running time of insertion sort when its input is "nearly" sorted.

  Professional codes of ethics

Select one of the Professional Codes of Ethics associated with IT. If you were to complete a assignment related to securing the connectivity in your firm and its business partners.

  Use of sequential or relational file

Assume you wish to keep a record of everything you have in your house. You could use a sequential data document to keep track of common items such as 'cloths'.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd