In line 14, of the following header, it uses only 1 field, which is a double, named value.
What if I was working with a record of multiple peoples?
A field of a person would be: int age, string name, double height.
Header
// Specification file for the NumberList class
#ifndef NUMBERLIST_H
#define NUMBERLIST_H
//#include <cstdlib>
#include <iostream> // for NULL
using namespace std;
class NumberList
{
private:
// Declare a structure for the list
struct ListNode
{
double value; // The value in this node
struct ListNode *next; // To point to the next node
};
ListNode *head; // List head pointer
public:
// Constructor: notice the constructor initializes the head pointer to NULL (0)
// This establishes an empty linked list.
NumberList()
{ head = NULL; }
// Destructor: destroys the list by deleting all its nodes.
~NumberList(); //Is declared in NumberList.cpp
//{}
// Linked list operations
// These functions are defined in NumberList.cpp.
void appendNode(double);
void insertNode(double);
void deleteNode(double);
void displayList() const;
};
#endif
A program that demonstrates using multiple fields for a linked list would be appreciated. I had no luck with searching on google.

New Topic/Question
Reply



MultiQuote




|