Question
Write a program pronounce.cpp that Lets the user input a word (lets call the input word W). If the word is not found in the
Write a program pronounce.cpp that Lets the user input a word (lets call the input word W). If the word is not found in the dictionary, print Not found. Otherwise, report: Pronunciation : the pronunciation of the word W (as given in the dictionary), Identical : other words from the dictionary with the same pronunciation as W, Add phoneme : words that can be obtained from W by adding one phoneme, Remove phoneme : words that can be obtained from W by removing one phoneme, Replace phoneme : words that can be obtained from W by replacing one phoneme. Write a program pronounce.cpp that Lets the user input a word (lets call the input word W). If the word is not found in the dictionary, print Not found. Otherwise, report:
Pronunciation : the pronunciation of the word W (as given in the dictionary),
Identical : other words from the dictionary with the same pronunciation as W,
Add phoneme : words that can be obtained from W by adding one phoneme,
Remove phoneme : words that can be obtained from W by removing one phoneme,
Replace phoneme : words that can be obtained from W by replacing one phoneme.
For dividing a string into words, we can give you a helper function, which receives a string argument s, and splits it into two strings on the very first space it finds within the string s: Example: "Fortune favors the bold" ? "Fortune" and "favors the bold". void splitOnSpace(string s, string & before, string & after) { // reset strings before = ""; after = ""; // accumulate before space int i = 0; while (i < s.size() && not isspace(s[i])) { before += s[i]; i++; } // skip the space i++; // accumulate after space while (i < s.size()) { after += s[i]; i++; } }
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