IN c++ Type a word to end it. If it does not match the word already entered, che
ID: 3848101 • Letter: I
Question
IN c++
Type a word to end it. If it does not match the word already entered, check it out. Exclude duplicate words. If you type end, you end the input and in turn write the words you type
required position
:
1) Input by keyboard and output to monitor
2) Input words are stored in dynamic allocation according to their length.
3) Check well for overlapping words and ending words
4) Must be able to output all input words at the end
5) Maximum number of words that can be input is limited to 100
show like these :
Enter a word: apple
Enter a word: elephant
Enter a word: tiger
Enter a word: rabbit
Enter a word: tiger
#already used!
Enter a word: pineapple
#wrong word!
Enter a word: tomato
Enter a word: end
apple elephant tiger rabbit tomato
Explanation / Answer
Hi,
I have heavily commented the code for deeper understanding. Feel free to comment if you have any queries. I have used vector to store the words but an array could be used too. Please give a thumbs up if this answer heled you.
//Code starts here
//Code ends here
Sample output:
Enter a word: apple
Enter a word: elephant
Enter a word: tiger
Enter a word: rabbit
Enter a word: tiger
#already used!
Enter a word: pineapple
#wrong word!
Enter a word: tomato
Enter a word: end
apple elephant tiger rabbit tomato
Hope it helps!