Please C++ programming
1. Write a Ch program that will repeatedly perform the following text file analysis tasks. - It will prompt the user to enter a text file name and then open the file for reading. - It will count the number of words in the open text file and display this count along with the average word length (average number of characters per word), the total number of word characters, the total number of punctuation characters, the length of the shortest word, and the length of the longest word. - It will list all of the shortest words found in the text file. It will list all of the longest words found in the text file. It will search for a word specified by the user and report how many times the word occurs in the text file. The program will display all of the results on the screen as well as writing the results to an output report text file. The main function of your program should first ask the user for the name of the output report file and open the file for writing. Then it should repeatedly offer the user a menu of the above tasks. Each of the above tasks should be implemented in your program as separate functions. Note: A word is defined to be a string of symbols that is preceded and followed by whitespace or the beginning of the line or the end of the line, or a portion of such a string. If such a string begins and ends with non-punctuation characters, then the string is a word. If such a string begins or ends with punctuation characters, the word embedded in the string will be the string with preceding and ending punctuation characters removed. In either case, punctuation characters in the punctuation characters removed. In either case, punctuation characters in the middle of the string should not be removed and should be considered part of the word. So, the punctuation count should include those punctuation characters before or after a word, but not include punctuation characters embedded in a word. Note: The length of a word followed by a punctuation character does not include the punctuation character. File handling notes: An input file must be open before the user selects any of the above options other than the first one. So, the functions that handle the other tasks need to check to see if an input file is open before doing their task. To determine if the input file is currently open, you can use this function call which returns true if the file associated with fin is open: fin.is open If the user selects the first option and an input file is already open, the function handling that task should first close the input file before attempting to open a new one. Each function that processes the input file will need to have the input file positioned to read at its beginning. Include this code to accomplish this task (assume that fin is the ifstream object that refers to your input file in the program): fin.clear(); fin.seekg(0); ifstream and ofstream function parameters must be passed by reference. Note: if you use story.txt as input file, the following output (both on screen and output file) would be a sample run of the program: Filename: story.txt Total number of words = 179 Average word length = 4.9162 characters. Shortest word length = 1 I Longest word length = 13 Filename: story.txt Shortest words in file: a a a a a Filename: story.txt Longest words in file: disappointing participation Massachusetts Filename: story.txt Search word: hello This word appears 0 time(s) in the file Filename: story.txt Search word: disappointing This word appears 1 time(s) in the file