Question: c++ LinkedList.h #ifndef LinkedList_h #define LinkedList_h #include using namespace std; struct LinkedList { struct Link { void* data; Link* next; void initialize(void* dat, Link* nxt)

 c++ LinkedList.h #ifndef LinkedList_h #define LinkedList_h #include using namespace std; struct

c++

LinkedList.h

#ifndef LinkedList_h #define LinkedList_h

#include

using namespace std;

struct LinkedList { struct Link { void* data; Link* next; void initialize(void* dat, Link* nxt) { data = dat; next = nxt; } }* head;

Link *end; int size; // This should initialize fields for the empty LinkedList void initialize() {

} /* * This adds an element containing *dat * to the end of the LinkedList. * It assumes that *dat is dynamically allocated */ void add(void* dat) {

} /* * This returns the data at position index */ void* get(int index) { } /* * Frees the memory of the LinkedList */ void cleanup() { } }; #endif

You are now going to create a LinkedList structure that will work very similarly to the Stack structure seen in the book and used in the previous exercise). The starter code is provided in LinkedList.h. After you complete the LinkedList.h, create another program which will use your LinkedList.h similar to the previous exercise. That is, your code should read in floating point numbers from input.txt, and store them in a LinkedList. Then it should iterate through the Linked List, and print out the stored values. Then it should clear up LinkedList, and free all the dynamically allocated memory. Input input is in input.txt Output 16 2.3 -4.5 22 -0.4 87 34.9 -40.1 -10.5 8.8 101.4 2.56 -3.14 9.78 12.3 -3.1 1.2

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!