Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include // function prototypes: void addSpaces(char *s); void highestLetterFrequency(const char *s); void flipMiddle(char *); int main( ) { int i; char orig[4][31] =
#include#include #include // function prototypes: void addSpaces(char *s); void highestLetterFrequency(const char *s); void flipMiddle(char *); int main( ) { int i; char orig[4][31] = { "news", "hello world!", "why are we here?", " " }; char freq[3][81] = { "where do you want to go today?", "hello world", "prg355... is it better than prg255?" }; char flip[4][31] = { "123456789", "hello world", "a12x", "abc" }; for(i=0; i<4; i++) { addSpaces(orig[i]); printf("'%s' ", orig[i]); } for(i=0; i<3; i++) { highestLetterFrequency(freq[i]); } for(i=0; i<4; i++) { flipMiddle(flip[i]); printf("%s ", flip[i]); } return 0; }
void addSpaces(char *s) { //This function INSERTS a single space after any non-space character that is present within the string 's'. // your code here ... } void highestLetterFrequency(const char *s) { //That determines the letter (alphabetic letters only) that appears with the highest frequency in the string 's'. Once complete, the function prints the letter followed by a space followed by the number of times the character appeared in the string (as an unsigned long) followed by the newline. If two characters have the same frequency, then the first character that was encountered is displayed. // your code here ... } void flipMiddle(char *) { //that reverses the order of all characters in the string except the first and last character. You may assume that the string will be at least 2 characters in length. // your code here ... }
/* CORRECT OUTPUT: 'n e w s ' 'h e l l o w o r l d ! ' 'w h y a r e w e h e r e ? ' ' ' o 5 l 3 t 4 187654329 hlrow olled a21x abc */
Step 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