This assignment must be done in C only! NOT C++! Create a program called that do
ID: 3536176 • Letter: T
Question
This assignment must be done in C only! NOT C++!
Create a program called that does the following:
The absolute frequency of a character is the number of times the character appears. For example, in the string "aaab" the absolute frequency of 'a' is 3, and the absolute frequency of 'b' is 1.
The relative frequency of a character is the absolute frequency divided by the total number of characters. For example, in the string "aaab" the relative frequency of 'a' is 3/4 = 0.75, and the relative frequency of 'b' is 1/4 = 0.25. Relative frequency * 100 will give you the result in percentage
Sample Output
Program: String Processing
Author: Name Here
Enter string 1: This is a string
Enter string 2: This is also a string
Enter string 3: This is a test
String 1 is 16 bytes long, and String 2 is 21 bytes long
String 3 is: "This is so a string"
FREQUENCY TABLE
---------------
Char Count % of Total
---- ----- ----------
ALL 14 100.00%
" " 3 21.43%
"T" 1 7.14%
"a" 1 7.14%
"e" 1 7.14%
"h" 1 7.14%
"i" 2 14.29%
"s" 3 21.43%
"t" 2 14.29%
Explanation / Answer
#include #include #include int main() { char string1[254]; char string2[254]; char mash; int string01, string02, mash01; string01 = strlen(string1); string02 = strlen(string2); printf("Program: String Processing "); printf("Author: Eric Redjou "); printf("Enter data for string 1 that is less than 255 characters: "); fgets(string1,254,stdin); printf("Accepted: %s", string1); printf("Enter data for string 2 that is less than 255 characters: "); fgets(string2,254,stdin); printf("Accepted: %s,", string2); strncpy(mash, string1, string01 /2); mash[string01 / 2] =''; printf(" return 0; } /*scanf("%s, &string1"); /*printf("String entered: %s ", string1); printf("Enter data for string 2 that is less than 255 characters: "); scanf("%s, &string2"); return 0; }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.