Page 1 of 1

Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use th

Posted: Tue Jul 12, 2022 8:04 am
by answerhappygod
Write A Function Main That Prompts The User To Enter A Filename And Counts The Number Of Keywords In The File Use Th 1
Write A Function Main That Prompts The User To Enter A Filename And Counts The Number Of Keywords In The File Use Th 1 (42.98 KiB) Viewed 178 times
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 test6.txt Enter the filename: tests.txt Error, No such file or directory Enter the filename: test6.txt The number of keywords in the file is 601