This question has been answered

this question about Linked List Build Forward in c++.

1 Attachment
Linked List Build Forward Problem: Suppose that we read a list of integers ending with -999. The following func±on, buildListForward, builds a linked list in a forward manner) and returns the pointer of the built list: Q1: The bulidListForward func±on to create a linked List structure with the keyboard input( cin >> num). Change this func±on to receive the values stored in the array from the main func±on( use int type pointer variable). eg. nodeType* buildListForward(int *arrayPrt, int Size) Q2: Implement main func±on to call bulidListForward with an array type actual parameter that contains node informa±on 2, 15, 8, 24, 34. Q3: Declare a struct named nodeType which contains two members info and *link; Q4: Inside of the func±on buildListForward, change while loop to for loop to be able to get node informa±on from the array and put this node informa±on to newNode. Q5: At the main func±on, print out node informa±on by Traversing the Linked List that we have created at the main func±on and print out node informa±on as follows: Input int Size_Array = 5; int ArrayInfo[5] = { 2, 5, 8, 24, 34 }; Output & address of curr pointer 0x125cc20 & address of info: 0x125cc20 INFO: 2 LINK 0x125cc40 & address of info: 0x125cc40 INFO: 5 LINK 0x125cc60 & address of info: 0x125cc60 INFO: 8 LINK 0x125cc80 & address of info: 0x125cc80 INFO: 24 LINK 0x125cca0 & address of info: 0x125cca0 INFO: 34 LINK 0 nodeType* buildListForward( ) { nodeType *²rst, *newNode, *last; int num; cout << "Enter a ²rst of interges." << endl; cin >> num; ²rst = NULL;
Background image of page 1
while (num != -999) { newNode = new nodeType; newNode->info = num; newNode->link = NULL; if (Frst == NULL) { Frst = newNode; last = newNode; } else { last->link = newNode; last = newNode; } cout << "list of integers ending with -999." << endl; cin >> num; } //end while return Frst; } //end buildList±orward Hand in: 1) Source code and : Lab7.cpp, Lab7.doc ( Capture your screen shot) 2) Upload two Fles to the Black board.
Background image of page 2
Answered by Expert Tutors
1 Attachment
The student who asked this rated it
Linked List Build Forward Problem: Suppose that we read a list of integers ending with -999. The following function, buildListForward, builds a...
Get unstuck

252,291 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses