Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ Write a program that asks the user for 1) the name of a file that exists in the same directory as the running program
c++
Write a program that asks the user for 1) the name of a file that exists in the same directory as the running program and 2) a word and displays to a console 1) the number of times the individual word was found in the file 2) the percentage of words in the file that was the word, and 3) the total number of words in the file. Suppose that I have a file called matt.txt with the following contents in the same working directory: the dog was super happy that the cat came to play If the user types in matt.txt and the word the, the console should display 2, 18.1818%, and 11. If the user types in matt.txt and the word bob, the console should display 0, 0% and 11 respectively. The program may assume the file exists on disk and no error checking is needed. The file may be assumed to contain 1 word per line
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