Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ I need that as 3 different files, without using create the following files: A main.h header file that contains all compiler directives and C++
C++
I need that as 3 different files, without using
create the following files:
- A main.h header file that contains all compiler directives and C++ declarations for your program. Remember that header files should not contain any executable statements or result in any memory allocations.
- A main.cpp source code file that contains all of the executable statements for your program. Your main.cpp file may contain the #include for the main.h file but no other #include statements.
- A makefile used by the make that will compile your source code file(s) into an executable file named main.
functional requirements for your program:
- Accept an input file name from the user. You may use command line arguments, or read the file name from cin.
- If the input file can not be opened, display an appropriate message and end the program.
- For each distinct word in the file, count the number of times each word appears in the file. Remember, "word" means "C++ word", i.e. non-whitespace characters delimited by whitespace.
- Display the list of words (and their counts) in order of descending count. In other words, the most frequent word (with the largest count) should be displayed first, followed by the second-most frequent word, and so forth. The least frequent word should be displayed last. There may be some cases where more than one word has the same count, and in these cases you should display the words in alphabetical (ASCII) order.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started