Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that creates a simple directory for the occurrences of printable characters read from an input file. The program should read from

Write a C++ program that creates a simple directory for the occurrences of printable characters read from an input file. The program should read from a file name specified in the command line as an argument, However, if no file name is provided, the program should print on a new line "No file is found", and exit. If the file cannot be opened, print on a new line "File cannot be opened: ", followed by the file name, and exit. The program should read from the file words until the end of file. If the input file is empty, print out on a new line the message "File is empty." and then exit. A word is defined as a contiguous number of non-whitespace characters separated by whitespace. The program should keep a record of the number of occurrences of each letter, decimal digit (0-9), and any non-alphanumeric characters (e.g., ., ,, @, etc.) in a directory built using the container. In order to avoid counting uppercase and lowercase letters, all letters should be converted to uppercase. After all input has been processed, the program should

  • Print each decimal digit and letter that was seen the largest number of times on a line by itself and the number of times it was seen in the file.
  • Print each printable character read from the file and the number of times it was seen. The character should be printed in order.
  • Print the number of non-alphanumeric characters that were seen in the file.

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions