Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Assignment: Please use directory, along with STL containers. Thanks. Statement of Work: Implement a program that collects the statistics of word, number, and character

C++ Assignment:

image text in transcribed

Please use directory, along with STL containers. Thanks.

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 1. Create a 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 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 (a"..'z' or A'..'Z'). 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 "001" is different from number 1". 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. Your program should record the number of times each word, number, and character happens. 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 Since words are case insensitive, the program only outputs lower case words. The characters, numbers and words should be outputted in the descending order based on the number of times they are used. When two characters happen in the same number of times, the character with a smaller ASCll value should be considered as being used more frequently. When two words (numbers) happen in the same number of times, the word (number) that occurs earlier in the input should be considered as being used more frequently 4. An example executable code of the program proj1.x is provided to you. In proj1.x, the output related to the display of characters, words, and numbers is aligned in the following manner: the width of the column of the characters, words, and numbers is the length of the longest words and numbers to be displayed, plus five (5). You should make the outputs of your program the same as those of 'proj1.x'. When printing characters, use t' for tab and 1n' for newline. All other characters should be outputted 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 the built-in string type 7. Your program must be able to compile and run on linprog 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 1. Create a 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 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 (a"..'z' or A'..'Z'). 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 "001" is different from number 1". 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. Your program should record the number of times each word, number, and character happens. 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 Since words are case insensitive, the program only outputs lower case words. The characters, numbers and words should be outputted in the descending order based on the number of times they are used. When two characters happen in the same number of times, the character with a smaller ASCll value should be considered as being used more frequently. When two words (numbers) happen in the same number of times, the word (number) that occurs earlier in the input should be considered as being used more frequently 4. An example executable code of the program proj1.x is provided to you. In proj1.x, the output related to the display of characters, words, and numbers is aligned in the following manner: the width of the column of the characters, words, and numbers is the length of the longest words and numbers to be displayed, plus five (5). You should make the outputs of your program the same as those of 'proj1.x'. When printing characters, use t' for tab and 1n' for newline. All other characters should be outputted 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 the built-in string type 7. Your program must be able to compile and run on linprog

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago