0

I have a program project to complete, but I don't know exactly what to do. This program is in C++ programming language. This what I have to do?

Write a program that will use a array to store a linked list. Your linked list should contain an Student number and an the student's last name. You linked list should use the student number as the key field to order the list and contain a maximum of 8 students. Each line will start with a number that will indicate the operation. The data necessary to perform the operation will follow. Each operation shoud print out a message indicating that it was performed correctly. Your program should process the following operations:

Initialize an empty list

This operation should initialize the list to an empty list

0

Add an student to the list:

This operation should add this student to the linked list

1 4521 Smith

Delete an student from the list:

Delete this student from the linked list. If the student is not in the list, print a message.

2 1000

Print the list in Logical Order

3

Find an student in the list:

Find this student from the linked list. If the student is not in the list, print a message.

4 1000

Print the list in Physical Order

This operation should print the physical contents of the list along with all of the links, list and free.

5

Your program should read the input from a data file by redirecting the input to the program ($ a.out < datafile).

Example data file:

0
1 3000 Hill
1 1000 Smith
1 2000 Green
3
5


For this data file, the first operation should initialize the list, the next 3 operations should add the 3 students to the list, the 4th operation (3) should print the list logical order:

1000 Smith
2000 Green
3000 Hill

The last operation (5) should print the physical contents of the list.

list=1 avail= 3

0 3000 Hill -1
1 1000 Smith 2
2 2000 Green 0
3 4
4 5
5 6
6 7
7 -1

2
Contributors
1
Reply
3
Views
10 Years
Discussion Span
Last Post by Bench
0

This seems to me an excersize similar to serialisation. A real linked list would use pointers to connect the "nodes" - if you're using an array to simulate addressable memory, then use an int to contain the array indexes, simulating the pointers. The rest of the program should be fairly similar to a real linked list.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.