Question: C++ Write a program that reads a list of words from the Words.txt file (shown below), and stores it into a singly linked list, and

C++ Write a program that reads a list of words from the Words.txt file (shown below), and stores it into a singly linked list, and prints the words from the singly linked list to the console in reverse order. Implement the program, as outlined below in the pseudocode, using singly linked list interface to store the data read from Words.txt. ********Demonstrate that the list of words does print in reverse using the 'prev' node (rather than the 'next' node).**********

(Pseudocode, 3 classes) class ListInterface  // Sees whether this list is empty. // return True if the list is empty, or false if not. boolean isEmpty() // Adds a new entry to the list. // post If successful, newEntry is stored in the list and // the count of items in the list has increased by 1. // param newEntry The object to be added as a new entry. // return True if addition was successful, or false if not. boolean add(T newEntry) // Removes one occurrence of a given entry from this list, if possible. // post If successful, anEntry has been removed from the list and the count of // items in the list has decreased by 1. // param anEntry The entry to be removed. // return True if removal was successful, or false if not. boolean remove(T anEntry) // Removes all entries from this list. // post List contains no items, and the count of items is 0. void clear() // Counts the number of times a given entry appears in list. // param anEntry The entry to be counted. // return The number of times anEntry appears in the list. int getFrequencyOf(T anEntry) // Tests whether this list contains a given entry. // param anEntry The entry to locate. // return True if list contains anEntry, or false otherwise. bool contains(T anEntry) class Node T item // A data item Node prev // Important! previous node! // ... class List : ListInterface Node head; int itemCount; // ... 

(Words.txt) is as follows, this code should work even if file is changed to many more words:

when

what

there

been

one

could

very

an

who

them

weekend

we

now

more

out

do

are

up

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!