更新 '2.5.cpp'

This commit is contained in:
Kirigaya Kazuto 2017-09-17 20:37:28 +08:00
parent 37b51e3775
commit 67f514a15c

12
2.5.cpp
View File

@ -44,6 +44,17 @@ int main()
});
});
conn.exec("use bigdata5",nullptr);
conn.exec("select job_city,count(*) from pages where ( title like '%大数据%' ) group by job_city",[&](MySQLResult& res)
{
res.stepRow([&](char** val,unsigned long* len)
{
string city(val[0]);
int cc=ParseInt(val[1]);
mp[Trim(city)].push_back(cc);
});
});
ofstream ofs("result/2.5.csv");
for(auto iter=mp.begin();iter!=mp.end(); )
@ -76,6 +87,7 @@ int main()
#define cout ofs
cout<<"城市,大数据岗位数量"<<endl;
for(auto& pr:mp)
{
cout<<pr.first<<",";