Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi! Please help me by fixing my code and explaining how you did it. I need help ASAP!!! Thank you! Error Prompt: #include #include #include

Hi! Please help me by fixing my code and explaining how you did it. I need help ASAP!!! Thank you!

Error Prompt:

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed #include #include #include using namespace std;

char PrintMenu(string); int GetNumOfNonWSCharacters(string); int GetNumOfWords(string); void ReplaceExclamation(string &); void ShortenSpace(string &); int FindText(string, string);

int main(){ char option; string text, phraseToFind; cout > ch; switch (ch) { case 'q': case 'Q': exit(0); case 'c': case 'C': cout Number of non-whitespace characters w - Number of wordst f - Find text r - Replace all !'st s - Shorten spacest q - Quite 4 Choose an option: Number of non-whitespace characters:181 MENU c - Number of non-whitespace characters w - Number of words f - Find text r - Replace all !'s s - Shorten spaces q - Quit Choose an option: Number of non-whitespace characters: 181 MENU c - Number of non-whitespace characters w - Number of words f - Find text r - Replace all !'s s - Shorten spaces q - Quit Test ExecuteMenu('w', "This is a test."). Should output "Number of words: 4 " Compilation failed Compilationfailedmain.cpp:InfunctionbooltestPassed(stmain.cpp:38:4:error:Executemenuwasn38Executemenu(useroption,usrstr Enter a sample text: You entered: I want some water. I had som MENU c - Number of non-whitespace characterst w - Number of wordst f - Find textr r - Replace all !'st s - Shorten spacest q - Quite Choose an option:d Enter a word or phrase to find: "some water" instances: 3 MENU c - Number of non-whitespace characters w - Number of words f - Find text r - Replace all !'s s - Shorten spaces q - Quit Choose an option: Enter a word or phrase to be found: "some water" instances: 3 MENU c - Number of non-whitespace characters w - Number of words f - Find text r - Replace all !'s s - Shorten spaces q - Quit Choose an option: Tests that FindText() returns 5 for parameters "more" and "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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions