更新 '2.2.cpp'
This commit is contained in:
parent
6a1933bcc1
commit
e55f645773
14
2.2.cpp
14
2.2.cpp
@ -99,21 +99,23 @@ int main()
|
||||
|
||||
ofstream ofs("result/2.2.csv");
|
||||
#define cout ofs
|
||||
cout<<"行业,最低工资,最高工资,平均工资,数量"<<endl;
|
||||
cout<<"行业,最低工资(平均),最高工资(平均),平均工资,数量"<<endl;
|
||||
for(auto& pr:mp)
|
||||
{
|
||||
int sum=0;
|
||||
int lowest=9999999;
|
||||
int highest=-1;
|
||||
int lowsum=0;
|
||||
int highsum=-1;
|
||||
int szVec=pr.second.size();
|
||||
for(auto& pk:pr.second)
|
||||
{
|
||||
sum+=pk.ave();
|
||||
lowest=min(lowest,pk.low);
|
||||
highest=max(highest,pk.high);
|
||||
lowsum+=pk.low;
|
||||
highsum+=pk.high;
|
||||
}
|
||||
sum/=szVec;
|
||||
cout<<pr.first<<","<<lowest<<","<<highest<<","<<sum<<","<<szVec<<endl;
|
||||
lowsum/=szVec;
|
||||
highsum/=szVec;
|
||||
cout<<pr.first<<","<<lowsum<<","<<highsum<<","<<sum<<","<<szVec<<endl;
|
||||
}
|
||||
#undef cout
|
||||
|
||||
|
Reference in New Issue
Block a user