Write a search method to determine if a word is in the list

Assignment Help Computer Engineering
Reference no: EM132158181

ONLY USE:

#include <iostream>

#include <fstream>

#include <stdlib.h>

#include<string>

using namespace std;

Construct C++ program ,THAT USES LINKED LIST, that inputs a text file, scans for words and builds a list of the words in the file and a count of the number of occurrences of each word. For example

This is a test It's only a test

produces

A 2

IS 1

IT'S 1

ONLY 1

TEST 2

THIS 1

Expect no punctuation except apostrophes such as in "it's". Convert all alphabetic characters to upper case.

The data structure required for this program is a linked-list of structures. This is the structure:

struct wordstruct {

string word;

short count;

wordstruct *next;

};

You may make it a class if you wish.

The link-list class (CWordList) must insert each word in correct alphabetical order. Do not sort the list but insert into the list at the correct position.

I suggest your write a search method to determine if a word is in the list or not and a separate insert method. You will need a print method as well.

The algorithm is :

1. get a word from the file

2. determine if it is in the list

3. if so, increment the counter for that word (count in wordstruct)

4. if not find the correct location in the list and add the word

5. repeat until eof

Only after all the file is processed should the program output the list and count.

Try you code on this:

To be or not to be that is the question Whether tis nobler in the mind to suffer

The slings and arrows of outrageous fortune Or to take arms against a sea of troubles And by opposing end them

To die to sleep No more and by a sleep to say we end The heartache and the thousand natural shocks That flesh is heir to Tis a consummation

Devoutly to be wished To die to sleep To sleep perchance to dream ay there's the rub For in that sleep of death what dreams may come When we have shuffled off this mortal coil Must give us pause There's the respect That makes calamity of so long life

For who would bear the whips and scorns of time The oppressor's wrong the proud man's contumely The pangs of despised love the law's delay

The insolence of office and the spurns That patient merit of the unworthy takes When he himself might his quietus make With a bare bodkin Who would fardels bear To grunt and sweat under a weary life But that the dread of something after death

The undiscovered country from whose bourn No traveller returns puzzles the will And makes us rather bear those ills we have Than fly to others that we know not of Thus conscience does make cowards of us all And thus the native hue of resolution Is sicklied o'er with the pale cast of thought And enterprise of great pitch and moment With this regard their currents turn awry And lose the name of action.

Reference no: EM132158181

Questions Cloud

What is the expected ratio of progeny phenotypes : a) What is the expected ratio of progeny phenotypes assuming independent assortment of alleles? b) Explain how the actual ratio of progeny (above) shows
Create appropriate constructors : Create appropriate constructors, getters and setters and appropriate override of toString() method.
Depicting the distance in cm between the canine : Please look at my attached measurements which are depicting the distance in cm between the canine tooth and the last molar for 35 wolves.
Do you think that the iwls approach is still useful the days : The use of the IWLS algorithm to fit generalized linear models was extremely useful when it was developed in the late 1970s/early 1980s.
Write a search method to determine if a word is in the list : Write a search method to determine if a word is in the list or not and a separate insert method. You will need a print method as well.
Write a method called remove that accepts one arraylist : Write a method called remove that accepts one ArrayList parameter and one char parameter.
Write a menu driven script that calls a trash script : Using the select command from the korn shell, write a menu driven script that calls a trash script in the given manner.
Identify and discuss one disadvantage or possible downside : What are the benefits? Identify and discuss one disadvantage or possible downside.
Create a bookfactory to construct the required object : Create a BookFactory to construct the required object and use the enum Books. Use virtual functions to read and print the data.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd