Your program will generate N random numbers between 0 and 9 where each number represents the number of occurrences of a word in a text document

computer science

Description

Overview 

Your program will generate N random numbers between 0 and 9 where each number represents the number of occurrences of a word in a text document. The N words are all in one single document. Your program will compute the frequency of each word in the document and displays the highest and lowest frequencies. 


Details 

The program prompts the user for N, an integer between 5 and 20, generates N random positive integers between 0 and 9, and then displays these numbers and the size of the document. Your program will then compute the frequency of each word using the following formula and displays the highest and lowest frequencies.


Write two versions of the program: 

1. Write the program without macros (i.e. don't use m4). Use a pre-test loop, where the test is at the top of the loop. 

2. Rewrite the above program by putting the loop test at the bottom of the loop (make sure it is still a pretest loop) and add macros to the above program to make it more readable (use m4). In particular, provide macros for heavily used registers. 


Related Questions in computer science category