I dont know what is wrong I have tried changing and the error keeps on piling up.
I have a main.cpp which is this one.
#include <iostream.h>
#include "FloatList.h"
void main(void)
{
FloatList List;
list.appendNode(2.5);
list.appendNode(7.9);
list.appendNode(12.6);
}
and my header file is this one.
class FloatList
{
private:
struct ListNode
{
float value;
struct ListNode *next;
};
ListNode *head;
public:
FloatList()
{ head = NULL; }
~FloatList();
void appendNode(float num);
void insertNode(float num);
void deleteNode(float num);
void displayList();
};
and my implementation file was this one
void FloatList::appendNode(float num)
{
ListNode *newNode, *nodePtr;
newNode = new ListNode;
newNode->value = num;
newNode->next = NULL;
if (!head)
head = newNode;
else
{
nodePtr = head;
while (nodePtr->next)
nodePtr = nodePtr->next;
nodePtr->next = newNode;
}
cout << "Input has been APPENDED!" << endl;
}