C++使用HTTPLIB库调用百度翻译API代码
代码如下:
//需要安装httplib,openssl
//本代码使用json库进行网页内容解析,如直接使用,请安装json库,也可自行选择其他内容解析方式
#include "httplib.h"
#include <stdio.h>
//#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/md5.h>
#include "json.h"
typedef Json::Writer JsonWriter;
typedef Json::Reader JsonReader;
typedef Json::Value JsonValue;
//输入:需要翻译的英文单词,string类型
//输出:翻译后的中文结果,string类型
std::string PlaceNameTranslation(std::string tenStr)
{
if (tenStr.length() > 0)
if 

发布评论