C++ 字典 API

标签 c++ api

<分区>

有人知道 C++ 的字典 API 可以让我搜索单词并取回定义吗?

(我不介意是不是在线API,非要用JSON或者XML解析)

编辑: 抱歉,我的意思是字典中的单词定义。不是 C++ 映射。抱歉造成混淆。

最佳答案

使用 std::map<string,string> 那么你可以这样做:

#include <map> 
map["apple"] = "A tasty fruit";
map["word"] = "A group of characters that makes sense";

然后

map<char,int>::iterator it;
cout << "apple => " << mymap.find("apple")->second << endl;
cout << "word => " << mymap.find("word")->second << endl;

打印定义

关于C++ 字典 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5282779/

相关文章:

java - Angular 的请求不要在后端映射我的 API(Spring Boot)

c++ - C++(或任何其他语言)中的优雅控制流

c++ - 这个函数如何从链表中删除一个元素?

c++ - Asio 编译器错误(Win7 64 位 + VC11)

json - 使用 JSONP 技术从 Geonames API 加载国家国旗

c# - C# 中的 Google 网站站长工具 API

c++ - SystemC如何获取交互式用户输入

C++ 字符串的排列,输出结果小于或等于字符串的长度

c# - 松弛 API 和 OAuth 2.0

java - AWS API Gateway 自定义授权方。如何在 lambda 中访问 principalId