can someone help me complete this code please, on the ares i put comments please. thanks

#include <stdio.h>
#include <string.h>

class wordRecord {
char* word;
wordRecord* next;

void printWord() {
printf("%s\n", word);

class abstractWordList {
void printWordsHelper(wordRecord* wordRecPtr) {
if (wordRecPtr) {

// Code omitted to print the word list in reverse order.
// Your code should achieve this by calling printWordsHelper()
// recursively to print the remainder of the list THEN printing
// the current word.
// You need two statements:
// The first should call printWordsHelper(), passing the "next"
// pointer of whatever wordRecPtr points to as a parameter.
// The second should use the printWord() method to print out
// the word in the current wordRecord.


wordRecord* wordList;

abstractWordList() {

void printWords() {
// Print out all the words in the list

bool containsWord(char* aWord) {
// Return true if aWord is contained in the list; false otherwise
wordRecord* wordRecPtr = wordList;
bool found=false;

// Code omitted to step through the word list, setting "found"
// to true if the required word is found

return found;

class nonUniqueWordList : public abstractWordList {
virtual void addWord(char* aWord) {
// Add the word to the beginning of the list of words
int word_size=strlen(aWord) + 1;
char* dest=new char[word_size];
strcpy(dest, aWord);
wordRecord* newRec=new wordRecord;
newRec -> word=dest;
newRec -> next=wordList;

class uniqueWordList : public abstractWordList {
virtual void addWord(char* aWord) {
// Code omitted to add the word to the beginning of the
// list in the same way as in the nonUniqueWordList method,
// but only if the list doesn't already contain the word.
// (Test this using the containsWord() method.)

int main() {
nonUniqueWordList* wl = new nonUniqueWordList();

char inputWord[80];

// Read in words from the keyboard and add them to the list
printf("Enter words:\n");
scanf("%s", inputWord);

while (strcmp(inputWord,"END")!=0) {
scanf("%s", inputWord);

printf("Words entered:\n");

delete wl;


Votes + Comments
Calling your thread 'C++' in a C++ forum, are you serious ?
9 Years
Discussion Span
Last Post by Sky Diploma

Dude , This is not a Homework Completion Service. If you have any problems with the code. We help find errors and provide ways of correcting them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.