Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ques write a program in c language that meets the following requirements. Requirements . Write a program that calculates the frequency of letter occurrences in

Ques write a program in c language that meets the following requirements.

image text in transcribed

Requirements . Write a program that calculates the frequency of letter occurrences in text. . Read ASCIl text from standard input On reaching EOF, print to stdout the normalized frequency of occurrence for each letter a-z that appeared in the input, one per line, in alphabetical order using the format produced by printf( "%c %.4f ", letter, freq ); . Letters that occur zero times should not appear in the output Characters other than lower and upper case letters should be ignored Lower and upper case instances count as the same letter, e.g. 'a' and 'A' are both reported for the letter 'a' on the output. The frequencies reported should sum to approximately 1 (with a little slack for accumulation of printf rounding errors) Example runs Assume you have named yourexecutable lfreq. The first two example runs show the user entering the text manually in the terminal. The third and fourth runs have text piped in from a file (and the middle of the alphabet is omitted from the output for brevity). A text file happy_prince.txt containing a classic story in English is provided for testing ./lfreq aaab a 0.7500 b 0.2500 ./lfreq q 1.0000 ./1freq

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

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago