- Write A Function Main That Prompts The User To Enter A Filename And Counts The Number Of Keywords In The File Use Th 1 (41.15 KiB) Viewed 112 times
Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use th
Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use the exact same messages in the example). Keep in mind that your program should catch all possible errors and continue to request the filename from the user. I have uploaded some files so that you can use them. Filenames: test.txt, test2.txt, test3.txt, test6.txt In case of an error use the message "Error, No such file or directory" Here is a sample run: <Output> Enter the filename: test.txt The number of keywords in the file is 7 <End Output> The message you should use as follows. "Enter the filename: " "Error, No such file or directory" "The number of keywords in the file is" For example: Test Input main() test.txt main() testssss.txt Result Enter the filename: test.txt The number of keywords in the file is 7 Enter the filename: testssss.txt tests.txt Error, No such file or directory Enter the filename: tests.txt test6.txt Error, No such file or directory Enter the filename: test6.txt The number of keywords in the file is 601