cs201/PG3/Node.h

29 lines
709 B
C
Raw Normal View History

2016-09-20 21:06:42 +00:00
//Ben Harris
//Node.h is a header file for Node methods
#ifndef _NODE_
#define _NODE_
#include <iostream>
#include <string>
#include <cstdlib>
2016-09-20 21:06:42 +00:00
using namespace std;
class Node {
2016-09-20 21:06:42 +00:00
private: // Each Node contains a vale, count, and a pointer to the next Node in the list.
string value;
int cnt;
Node *next;
2016-09-20 21:06:42 +00:00
public:
Node(string s, Node *n); // Node Constructor
~Node(); // Node Destructor
string getvalue(); // Value accessor
int getcount(); // Count accessor
Node *getnext(); // Next pointer accessor
void
add(string s); // Adds a new Node to a list, incrementing the count for a Node if the same string is entered more than once.
2016-09-20 21:06:42 +00:00
};
#endif