Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a computer program as a Win32 console application in C to count the number of times every word occurs in a text file. The

image text in transcribed
Write a computer program as a Win32 console application in C to count the number of times every word occurs in a text file. The program shall then print the word that occurs most frequency and the number of times it appears in the file. If there is tie of words that occurs most frequency, then pick the first one for output display. The name of your source program shall be p5.c and that of your executable program shall be p5.exe. Your program shall receive information from the user as a command-line argument. For example, a typical command line to start your program (from a command prompt) might be L: > p5 testfile.txt Your program shall NOT seek information from the user such as by a call to scanf(). Your program shall NOT print information to the screen except as required herein. If your program is started without any command-line arguments, it shall print the following line to the screen and terminate execution: EE 233 Spring 2017 P5, , (Fill in your real name in place of and be sure to follow the output with a newline. Do not print the less-than and greater-than characters.) If your program is started without any command-line arguments, it shall print the following line to the screen and terminate execution: EE 233 Spring 2017 P5, , (Fill in your real name in place of and be sure to follow the output with a newline. Do not print the less-than and greater-than characters.) If your program is started with at least one command-line argument, it shall NOT print the line given above but shall proceed with normal execution. The first command-line argument (after the program name itself) will be the name of the text file for your program to read. No line in this file will contain more than 80 characters. If the file supplied as a command-line argument cannot be opened, your program shall write an error message and terminate execution. In a similar manner, your program shall properly handle all error conditions that might arise. Your program shall read the input text file and count the number of times each unique word occurs. A word is defined as a sequence of characters that is bounded by white space and that contains no characters other than letters of the alphabet (no numbers or punctuation marks, etc.). Two words that differ only in the case (upper or lower) of some of their characters are to be considered as the same word. A word will be no longer than 30 characters. Your program shall be able to count at least 500 different words. If more than 500 unique words are in the input file, your program shall print an error message saying that more than 500 unique words have been encountered and terminate execution, without presenting the normal output result. After your program has read and processed the entire file, that does not exceed the 500 unique word limit, it shall write the following (single) line to the screen containing the results. The word, , occurred 0000 times in . (Fill in the word with the highest frequency of occurrence in place of , and the actual file name in place of . Be sure to follow the output with a newline.) This completed program is due by 11:59 p.m. on Thursday, March 23rd, 2017. Write a computer program as a Win32 console application in C to count the number of times every word occurs in a text file. The program shall then print the word that occurs most frequency and the number of times it appears in the file. If there is tie of words that occurs most frequency, then pick the first one for output display. The name of your source program shall be p5.c and that of your executable program shall be p5.exe. Your program shall receive information from the user as a command-line argument. For example, a typical command line to start your program (from a command prompt) might be L: > p5 testfile.txt Your program shall NOT seek information from the user such as by a call to scanf(). Your program shall NOT print information to the screen except as required herein. If your program is started without any command-line arguments, it shall print the following line to the screen and terminate execution: EE 233 Spring 2017 P5, , (Fill in your real name in place of and be sure to follow the output with a newline. Do not print the less-than and greater-than characters.) If your program is started without any command-line arguments, it shall print the following line to the screen and terminate execution: EE 233 Spring 2017 P5, , (Fill in your real name in place of and be sure to follow the output with a newline. Do not print the less-than and greater-than characters.) If your program is started with at least one command-line argument, it shall NOT print the line given above but shall proceed with normal execution. The first command-line argument (after the program name itself) will be the name of the text file for your program to read. No line in this file will contain more than 80 characters. If the file supplied as a command-line argument cannot be opened, your program shall write an error message and terminate execution. In a similar manner, your program shall properly handle all error conditions that might arise. Your program shall read the input text file and count the number of times each unique word occurs. A word is defined as a sequence of characters that is bounded by white space and that contains no characters other than letters of the alphabet (no numbers or punctuation marks, etc.). Two words that differ only in the case (upper or lower) of some of their characters are to be considered as the same word. A word will be no longer than 30 characters. Your program shall be able to count at least 500 different words. If more than 500 unique words are in the input file, your program shall print an error message saying that more than 500 unique words have been encountered and terminate execution, without presenting the normal output result. After your program has read and processed the entire file, that does not exceed the 500 unique word limit, it shall write the following (single) line to the screen containing the results. The word, , occurred 0000 times in . (Fill in the word with the highest frequency of occurrence in place of , and the actual file name in place of . Be sure to follow the output with a newline.) This completed program is due by 11:59 p.m. on Thursday, March 23rd, 2017

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

Students also viewed these Databases questions