Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is in C. I have most of the problem done however cannot figure out the last two errors that i am getting. Any

This program is in C. I have most of the problem done however cannot figure out the last two errors that i am getting.

Any help is appericated. My code and errors are below.

Errors

image text in transcribed

image text in transcribed

My code

#include #include #include

int GetNumOfNonWSCharacters(const char usrStr[]) { int num = 0,i; for (i = 0; i

int GetNumOfWords(const char usrStr[]) { int num = 1, i; for ( i = 0; i

} return num;

}

void FixCapitalization(char usrStr[]) { usrStr[0] = toupper(usrStr[0]); int i;

for (i = 0; i

}

}

void ReplaceExclamation(char usrStr[]) { int i = 0; for (i = 0; i

}

}

void ShortenSpace(char usrStr[]) { int i,j;

for (i = 0; i

}

char PrintMenu(char usrStr[]) { char menuOp = ' ';

printf("MENU "); printf("c - Number of non-whitespace characters "); printf("w - Number of words "); printf("f - Fix capitalization "); printf("r - Replace all !\'s "); printf("s - Shorten spaces "); printf("q - Quit ");

while (menuOp != 'c' && menuOp != 'w' && menuOp != 'f' && menuOp != 'r' && menuOp != 's' && menuOp != 'o' && menuOp != 'q') { printf("Choose an option: "); scanf(" %c", &menuOp); }

if (menuOp == 'c') { printf("Number of non-whitespace characters: %d ", GetNumOfNonWSCharacters(usrStr)); menuOp = ' '; } else if (menuOp == 'w') { printf("Number of words: %d ", GetNumOfWords(usrStr)); menuOp = ' '; } else if (menuOp == 'f') { FixCapitalization(usrStr); printf("Edited text: %s ", usrStr); menuOp = ' '; } else if (menuOp == 'r') { ReplaceExclamation(usrStr); printf("Edited text: %s ", usrStr); menuOp = ' '; } else if (menuOp == 's') { ShortenSpace(usrStr); printf("Edited text: %s ", usrStr); menuOp = ' '; }

return menuOp; }

int main() { char userString[256]; char menuChoice = ' ';

printf("Enter a sample text: "); fgets(userString, 256, stdin); printf(" ");

printf("You entered: %s ", userString);

while (menuChoice != 'q') { menuChoice = PrintMenu(userString); }

return 0; }

Tests that FixCapitalization works correctly with "we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue!" Test feedback Fix Capitalization correctly edits the string 10. Compare output i want some water. he has some maybe he can give me some. nput f On Edited text: I want some water. h E has some maybe he can give me some. MENU c Number of non-whitespace characters Number of words Your output ends with f Fix capitalization r Replace a ll 's s Shorten spaces g Quit Choose an option: Maybe he can give me some Edited text: I want some water. He has some MENU c Number of non-whitespace characters Number of words Expected output ends f Fix capitalization r Replace a ll 's s Shorten spaces g Quit Choose an option

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago