菜鸟问一个C++程序

来源:百度知道 编辑:UC知道 时间:2024/06/21 17:04:35
7. Write a function to check if a word is in a dictionary, if the word exist in the dictionary, output “We found the word!”, else give the similar words. (10 ‘)

There have two rules for the “Similar words”
a) One letters less than the original words, and others letters are same.
b) One letters more than the original words, and others letters are same.
For Example:
The dictionary is [aback, abaft, abaisse, abbe, can, an, out, get,g, gtc,]

If we search “abaft”, the search result is “We found the word!”
If we search “gt”, the search result is “which word you try to find? get, g or gtc.”
If we search “notebook”, the search result is “notebook no found!”

类似是个查询的程序。
但以感觉不太像C++。
英语的意思是
如果查询到“abaft”显示的查询结果是 “We found the word!”
如果查询到“gt” 显示的查询结果是“which word you try to find? get, g or gtc.”
如果查询到“notebook”显示的查询结果是“notebook no found!”

输出的是:We found the word! which word you try to find? get, g or gtc. notebook no found!

不过有if,是不是后边应该有also?

我的英文不太好,他是不是要求你做一个程序。
写一个单词并检测是不是在字典里,是的话输出“We found the word.”否则给出“similar”这个单词。