Question
Please write this program in C. The objective is to write a program that will count the occurrences of letters in an input string, and
Please write this program in C.
The objective is to write a program that will count the occurrences of letters in an input string, and then output the results. The program should ask for user input first. The user should be able to input up to 1023 characters, and the program should store these characters as a C string. The program should have a buffer (char array), to store the string, with a maximum needed length to hold this many characters (however not more than the space required).
The program needs to count the number of characters of each letter from A to Z in the string. Uppercase and lowercase should be counted as occurrences of the character. The program should record the count of the A-Z characters in an array.
The total occurrences of each character should be output in a table, with also the percentage of the string that is comprised of each character from A-Z. There should be three columns: Letter - 10 characters, left-aligned, Occurrences - 15 characters, left-aligned , Percentage 15 characters, left-aligned, with two digits of precision.
Under the table there should be an output of the most frequently occurring character from A-Z, and the least occurring character. If there is a tie for either, then output any of the characters as most or least frequently occurring.
The program should run identically to these examples:
Enter text for analysis: The quick brown fox jumps over the lazy dog. Letter Analysis Complete! Letter Occurrences Percentage A B D E F G H I 1 1 1 1 3 1 1 2 1 1 1 1 1 1 4 1 1 2 1 2 2 1 1 1 1 1 2.27 2.27 2.27 2.27 6.82 2.27 2.27 4.55 2.27 2.27 2.27 2.27 2.27 2.27 9.09 2.27 2.27 4.55 2.27 4.55 4.55 2.27 2.27 2.27 2.27 2.27 The most frequently occurring character is 0. The least frequently occurring character is A. Enter text for analysis: aAAa zzzZZZz yxWV Letter Analysis Complete! Letter Occurrences Percentage 4 0 0 15.38 0.00 0.00 A B C D E F G H I J K L M N 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O 0 0 1 1 1 1 7 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3.85 3.85 3.85 3.85 26.92 The most frequently occurring character is z. The least frequently occurring character is BStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started