需要创建一个程序,用户可以输入一个单词,反转该单词,并使用链接列表检查该单词是否为回文单词。在程序结束时,它将列出输入单词中的所有回文单词。
程序必须包括以下方法/功能:
a) menu() – as interface for the user
b) add_word(string) – to enter the word to the list
c) show_list() – to display the lists
d) reverse_word(string) – to reversed the word
e) palindrome(string) – to check if the word is palindrome
f) palindrome_list() – to list all of the palindrome words
g) delete_list() – to delete list
Example, segment of output:
How many words you want to enter: 3
Please enter a word: kayak
Please enter a word: madam
Please enter a word: world
Reversed the word: kayak
Reversed the word: madam
Reversed the word: dlrow
kayak, is a palindrome word.
madam, is a palindrome word
world, is not a palindrome word.
List of the palindrome words: kayak, madam
Declaration node and functions:
//declaration of node
struct Node{
string p_word;
Node *plink;
};
void menu();
void add_word(string);
void show_list();
void reversed_word(string);
void palindrome(string);
void palindrome_list();
void delete_list()