C++, program that use the built in string class, its constructors, some of its methods and operators. It reads an input file of English text, one word at a time. The file should consist of about 500 words. Keep only the words, removing any punctuation or other characters. .Store the words in a built-in STL container, such as vector or map.,Choose a list of about 10 words, for example, {she,, and, he, or, the}., Remove these words from the list.,, Next count the number of occurrences of the 3 most frequent words. • Implement the code with optimized algorithms.
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
=================================
// aboutComputer.txt (Input file)
A computer is a device that can be instructed to carry out
an
arbitrary set of arithmetic or logical operations
automatically.
The ability of computers to follow a sequence of operations
called a program make CAT computers very flexible and useful.
Since ancient times simple CAT manual devices like the abacus
aided people in doing calculations. Early in the Industrial
Revolution, some mechanical devices were built to automate
long tedious tasks, such as guiding patterns for looms.
=========================================
#include <iostream>
#include <map>
#include <string>
#include <cctype>
#include <fstream>
#include <iomanip>
using namespace std;
void addWord(map<std::string,int> &words,string s);
void readFile(string infile,map<std::string,int>
&words);
void display(map<std::string,int> words);
int main() {
// Declaring variables
std::map<std::string,int> words;
//defines an input stream for the data file
ifstream dataIn;
string infile;
cout<<"Please enter a File Name :";
cin>>infile;
readFile(infile,words);
display(words);
return 0;
}
void readFile(string infile,map<std::string,int>
&words)
{
string s;
//defines an input stream for the data file
ifstream dataIn;
//Opening the input file
dataIn.open(infile.c_str());
//checking whether the file name is valid or not
if(dataIn.fail())
{
cout<<"'"<<infile<<"' File Not Found **";
exit(0);
}
else
{
//counting how many words in the file
while(dataIn>>s)
{
addWord(words,s);
}
dataIn.close();
}
}
void addWord(map<std::string,int> &words,string s)
{
char c;
string str="";
for(unsigned int i=0;i<s.length();i++)
{
c=s[i];
if(isalpha(c))
str.push_back(std::toupper(c));
}
++words[str];
}
void display(map<std::string,int> words)
{
cout<<"---------------------"<<endl;
cout<<"Word Counter Summary "<<endl;
cout<<"---------------------"<<endl;
cout<<"\nWord\t\tCount"<<endl;
cout<<"------\t\t-----"<<endl;
for(std::map<std::string,int>::iterator iter = words.begin();
iter!=words.end(); ++iter)
{
cout<<setw(16)<<left<<iter->first<<setw(5)<<right<<iter->second<<std::endl;
}
}
=======================================
Output:


=====================Could you plz rate me well.Thank You
C++, program that use the built in string class, its constructors, some of its methods and...
Problem 1. Implement a C++ program that has the following functions: Reads in a paragraph of English text up to 100 words from the keyboard and stores this paragraph in a string object. Feel free to include this task in the main() function. Identifies the least frequent letter (case insensitive) in the above paragraph. Implement a separate function getLeastFreqLetter() for this task. The main() function then calls this function to find out the least frequent letter and its frequency. Calculate...
Write a program, called wordcount.c, that reads one word at a time from the standard input. It keeps track of the words read and the number of occurrences of each word. When it encounters the end of input, it prints the most frequently occurring word and its count. The following screenshot shows the program in action: adminuser@adminuser-VirtualBox~/Desktop/HW8 $ wordCount This is a sample. Is is most frequent, although punctuation and capitals are treated as part of the word. this is...
Overview: file you have to complete is
WordTree.h, WordTree.cpp, main.cpp
Write a program in C++ that reads an input text
file and counts the occurrence of individual words in the file. You
will see a binary tree to keep track of words and their counts.
Project description:
The program should open and read an input file (named
input.txt) in turn, and build a binary search tree
of the words and their counts. The words will be stored in
alphabetical order...
Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...
Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...
C++ PRPGRAM- double-linked lists Create the .h and .cpp files for an Element class that contains the data and pointers for a double-link list for this application. Your linked list must consist of objects of this class. The class should contain at least the following elements (you may have more if you wish): The standard four constructors (default, parameterized, copy, move) The standard assignment operators (copy, move) A destructor Stream operators (<< and >>) The standard relational operators (<, <=,...
For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...
Implement the histogram function to complete the desired program. You must use dynamically allocated arrays for this purpose. For your initial implementation, use ordered insertion to keep the words in order and ordered sequential search when looking for words. Note that the array utility functions from the lecture notes are available to you as art of the provided code. Although we are counting words in this program, the general pattern of counting occurrences of things is a common analysis step...
Spanish Vocabulary Helper For this assignment, we are going to work with adding and removing data from arrays, linear search, and File I/O. In addition, you will learn to work with parallel arrays This program will assist an English-speaking user to build their vocabulary in Spanish This program will read a file containing a list of words in English and another containing the translation of those words in Spanish. The words and corresponding translations should to be stored in two...
Recursion and Trees Application – Building a Word Index Make sure you have read and understood · lesson modules week 10 and 11 · chapters 9 and 10 of our text · module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...