Answered step by step
Verified Expert Solution
Link Copied!

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:

  1. Accept an input file name from the user. You may use command line arguments, or read the file name from cin.
  2. If the input file can not be opened, display an appropriate message and end the program.
  3. 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.
  4. 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

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions