Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the C Programming language, write a program that will use Arrays to count the number of letters in the text. Idea: in your program

In the C Programming language, write a program that will use Arrays to count the number of letters in the text.

Idea: in your program work with arrays that will read lines of text from the keyboard and use an array to track the number of times each letter occurs in the input text. Then use the contents of this array to generate a histogram (bar graph) which will show the relative frequencies of each letter used.

Addition: Must write and include in your program: prog6_histogram.c: Source file containing main function; prog6_function.h: Header files containing function prototypes. prog6_function.c: Source file containing other user-defined functions. DONT USE LOOP or SWITCH STATEMENTS to compare input to different letters.

Need:

-the number of times each letter has occurred in the input and need the variables in main() to track.

-These values should be stored in an array where the first entry represents A or a characters entered and the last entry represents Z or z. Ex:your first Hello World! the array should look like{0,0,0,1,1,0,0,1,0,0,0,3,0,0,2,0,0,1,0,0,0,1,0,0,0}

- the nonzero values indicate the number of D,E,H,L,O,R and W characters entered respectively. Note that the character input are NOT case sensitive with uppercase and lowercase letters treated the same, and the maximum number of times any letter occurs.

these variable updates every time the user enters the R command and resets to 0 every time the user enters the C command, and when the user uses P command to print the histogram. Variable should be updated inside the Read Text() function and printed using the DrawHist () function. Lastly the program should repeatedly prompt the user to enter a single character command until the user enters the quit command, and perform the following operations: C, c == clear the letter count to 0. R,r == Read one line of text, update the letter count using ReadText() function. P,p == Plot the histogram of letter frequencies in all lines of text Q,q == Quit exit the program Print a vertical bar| to indicate the letter count, otherwise print a space. Leave spaces between columns. Print a vertical | bar for the letter count, otherwise print a space and leave spaces between columns. Thanks.

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

Recommended Textbook for

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions