Question 3: use a class [8]
Suppose a class with the following definition has been implemented for us:
class StringList {
public:
StringList(); // creates an (initially empty) list of strings
~StringList(); // deallocates the list of strings
void insert(string s); // inserts a string in the list
void displaySorted(); // displays the strings in the list
// sorted alphabetically
private: // the internal list representation
struct strNode {
string str;
strNode *next, *prev;
} *front, *back;
};
|