Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using a vector or map in C++, Objectives: Refresh C/C++ programming skills. Use C++ VO streams, string class, and STL containers and algorithms. Use makefile

Using a vector or map in C++,

image text in transcribed

Objectives: Refresh C/C++ programming skills. Use C++ VO streams, string class, and STL containers and algorithms. Use makefile to organize and compile programs. Statement of Work: Implement a program that collects the statistics of word, number, and character usage in a file (redirected as the standard input). Requirements: .Create subdirectory called proj1 2. For this project you need to create at least two files: proj1.cpp, and makefile. Both files should be placed in the proj1 directory 3. The file proj1.cpp should contain the main function, int main(). In the main() function, the program should read the input (from standard input) until it reaches the end, counting the number of times each word, number, and character is used. A word is defined as a sequence of letters (.,'z' or 'AZ). Words are case insensitive ("AA", "Aa", "aA", and "aa" are the same) A number is defined as a sequence of digits (0.9). Note that both words and numbers can be of length of 1, that is, contain one letter or one digit, respectively. Different sequences represent different numbers. For example, number "001is different from number"! Words are separated by numbers or other non-letter and non-digit characters. Numbers are separated by words or other non-letter and non-digit characters o o o Output specifications: Your program should track the number of times each word, number, and character happens o The program should then output the ten most used characters, the ten most used numbers, and the ten most used words as well as the number of times these charactersumbers/words are used. o Since words are case insensitive, the program only outputs lower case words. e The characters, numbers and words should be printed in the descending order based on the number of times they are used Handling tics When two characters occur the same number of times, the character with the smaller ASCII value should be considered as being used more frequently When two words (or numbers) occur the same number of times, the word (or number) that occurs earlier in the input should be considered as being used more frequently. 4. An example executable code of the program is provided to you (see below). You should make the outputs of your program match this sample executable. When printing characters, use V' for tab and n' for newline. All other characters should be printed normally. 5. Write a makefile for your project that compiles an executable called proj1.x 6. You are encouraged to use any C++ STL containers and algorithms. You should also use C++ string class instead of default c-strings. Here are a few good reference links for library lookups: Objectives: Refresh C/C++ programming skills. Use C++ VO streams, string class, and STL containers and algorithms. Use makefile to organize and compile programs. Statement of Work: Implement a program that collects the statistics of word, number, and character usage in a file (redirected as the standard input). Requirements: .Create subdirectory called proj1 2. For this project you need to create at least two files: proj1.cpp, and makefile. Both files should be placed in the proj1 directory 3. The file proj1.cpp should contain the main function, int main(). In the main() function, the program should read the input (from standard input) until it reaches the end, counting the number of times each word, number, and character is used. A word is defined as a sequence of letters (.,'z' or 'AZ). Words are case insensitive ("AA", "Aa", "aA", and "aa" are the same) A number is defined as a sequence of digits (0.9). Note that both words and numbers can be of length of 1, that is, contain one letter or one digit, respectively. Different sequences represent different numbers. For example, number "001is different from number"! Words are separated by numbers or other non-letter and non-digit characters. Numbers are separated by words or other non-letter and non-digit characters o o o Output specifications: Your program should track the number of times each word, number, and character happens o The program should then output the ten most used characters, the ten most used numbers, and the ten most used words as well as the number of times these charactersumbers/words are used. o Since words are case insensitive, the program only outputs lower case words. e The characters, numbers and words should be printed in the descending order based on the number of times they are used Handling tics When two characters occur the same number of times, the character with the smaller ASCII value should be considered as being used more frequently When two words (or numbers) occur the same number of times, the word (or number) that occurs earlier in the input should be considered as being used more frequently. 4. An example executable code of the program is provided to you (see below). You should make the outputs of your program match this sample executable. When printing characters, use V' for tab and n' for newline. All other characters should be printed normally. 5. Write a makefile for your project that compiles an executable called proj1.x 6. You are encouraged to use any C++ STL containers and algorithms. You should also use C++ string class instead of default c-strings. Here are a few good reference links for library lookups

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

Students also viewed these Databases questions

Question

Explain walter's model of dividend policy.

Answered: 1 week ago