Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ ExampleWorkingwithStrings.cpp is below This program demonstrates STL vector, string I/O and algorithms. **************************************************************************************/ #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include using namespace std; //***************************************************************************************************

C++image text in transcribed

ExampleWorkingwithStrings.cpp is below

This program demonstrates STL vector, string I/O and algorithms. **************************************************************************************/ #define _CRT_SECURE_NO_WARNINGS

#include #include #include #include #include

using namespace std; //*************************************************************************************************** // function prototypes //*************************************************************************************************** void RemovePunctuations(string &st);

//****************************************************************************************** int main(void) {

vector MyDictionary; // STL vector

// open a file for reading ifstream finp; finp.open("Magazine1.dat"); if (!finp.is_open()) { cout

// read the file, one word at a time string st; int i = 0; int nwords; while (finp >> st) { RemovePunctuations(st); // remove punctuations/special characters MyDictionary.push_back(st); // store the words in the vector cout

// sort the array, using STL algorithm "sort" sort(MyDictionary.begin(), MyDictionary.end()); cout

system ("pause"); return 0; }

//*************************************************************************************************** // Removes some punctuation //*************************************************************************************************** void RemovePunctuations(string &st) { int ASCIIVal; for (ASCIIVal = 34; ASCIIVal 1. In this problem, you will utilize the built in string class, its constructors, some of its methods and operators. You can utilize the ExampleWorkingWithStrings.cpp pro- vided on the Blackboard. . Read an input file of English text, one word at a time. The file should consist of about 500 words. Each student must select their own file. Some example files are AncientRome.dat and JuliaRobinson.dat, posted on the Blackboard. . Keep only the words, removing any punctuation or other characters e Store the words in a built-in STL container, such as vector or map. Choose a list of about 10 stop words, for example, {a, and, he, or, the Remove the stop words from the list . Next count the number of occurrences of the 3 most frequent words. . Implement the code with optimized algorithms

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Who will implement and maintain the project after launch?

Answered: 1 week ago

Question

Proficiency with Microsoft Word, Excel, PowerPoint

Answered: 1 week ago

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago