#include "MySQLWrapper.h" #include #include #include #include #include #include #include #include #include #include using namespace std; #include "local_db_account.h" #include "util.hpp" int main() { /// 3.6 计算机专业不同编程语言平均薪资柱状图. Based on 3.5 code. MySQLConn conn; conn.connect("127.0.0.1",db_user,db_passwd,"bigdata3",3306); cout<<"Connected to DB"<> langs { { "Java" }, { "C++" }, { "C#" }, { "Python", "Py" }, { "PHP" } , { "Javascript", "JS" }, { "Swift" }, { "Ruby" }, { "Perl" }, { "Visual Basic","VisualBasic","VB" }, { "Go" }, { "MATLAB" } }; map mp; int szLang=langs.size(); for(int i=0;isecond += cc; } else { mp.insert(make_pair(langs[i][0],cc)); } }); }); }; conn.exec("use bigdata3",nullptr); fn1(sqlcmd); ostr.str(""); ostr<<"select count(*) from pages where ((title like '%" <> vec; vec.insert(vec.end(),mp.begin(),mp.end()); /// ??? Not Naive Code? sort(vec.begin(),vec.end(),[](const pair& a,const pair& b) { return a.second > b.second; }); /// ----------- Above : 3.5 -------------- /// ----------- Below : 3.6 -------------- auto fn_getindex=[&](const string& LangMainLable) { int sz=langs.size(); for(int i=0;i> cashmp; int szLoop=min(10u,vec.size()); for(int i=0;i& vecref=cashmp[vec[i].first]; int szVec=vecref.size(); for(const auto& ky:vecref) { avLow+=ky.low; avHigh+=ky.high; } if(szVec!=0) { avLow/=szVec; avHigh/=szVec; avMid=(avLow+avHigh)/2; } cout<