So far, I've figured out how to get strings from a text file and put them into linked lists, but I'm having trouble understanding and making an array of linked lists.
// Filename: compiler.h
#include <iostream>
#include <fstream>
#include <cstdlib>
usingnamespace std;
struct nodeType
{
string word;
int count;
nodeType *link;
};
class Compiler
{
public:
Compiler();
bool search_list(string item); // Tells the client whether a spcific value is
//in the list.
// Calls a function search
void head_insert(); // Should be a member function
void add_to_count(); // Accesses the "current" pointer (in the private section)
// to update the count field of the node
// if the search is successful
friend ostream & operator<< (ostream &outfile, const Compiler & mylist);
// Overloaded operator to print both the data and the count field for each node
//int size()const; // yields manynodes
//void bubblesort();
protected:
nodeType *search1_list; // Called by the public function search_list
// sets the private member current to the node to be
// updated, or is NULL if the value is not there
//int manynodes;
private:
nodeType *current; // Add to the bag class.
// This pointer will be used in the search and again
// used to update the node if the data is already present
};
//void list_clear(nodeType*& head_ptr);
//void list_copy(const nodeType*source_ptr, nodeType*& head_ptr, nodeType*& tail_ptr);
educe
line
educe
primrose
depart
line
thwart
line
grand
cellular
line
educe
depart
manage
depart
headline
empire
torch
headline
line
myth
deposit
balance
cellular
educe
distance
distance
educe
cellular
balance
deposit
myth
line
headline
torch
empire
headline
depart
manage
depart
educe
line
cellular
grand
line
thwart
line
depart
primrose
educe
line
educe