Question: 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++C++ ExampleWorkingwithStrings.cpp is below This program demonstrates STL vector, string I/O and

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

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!