void Manager::sum()
{
int i,j,b,c,m,n,o,p;
if(top != 0){
cout<<"****************************"<<endl;
cout<<"* 1.按性别统计 *"<<endl;
cout<<"* 2.按类型统计 *"<<endl;
cout<<"****************************"<<endl;
cout<<" 请输入你的选项:";
cin>>i;
switch(i)
{
case 1:{
cout<<"当前雇员信息库中总人数为:"<<top<<"人"<<endl;
for(j = 0; j < top; j++)
{
if(wor[j].sex == "男")
b++;
if(wor[j].sex == "女")
c++;
}
cout<<"男性有"<<b<<"人,女性有"<<c<<"人"<<endl;
}
case 2:{
cout<<"当前雇员信息库中总人数为:"<<top<<"人"<<endl;
for(j = 0; j < top; j++)
{
if(wor[j].type == "经理")
m++;
if(wor[j].type == "技术人员")
n++;
if(wor[j].type == "销售人员")
o++;
if(wor[j].type == "销售经理")
p++;
}
cout<<"其中经理有"<<m<<"人,技术人员有"<<n<<"人"<<"销售人员有"<<o<<"人"<<"销售经理有"<<p<<"人"<<endl;
}
}
}
else
cout<<"雇员信息为空!"<<endl;
cout<<"按1返回主界面:"<<endl;
cin>>i;
if(i == 1)
{
Sleep(500);
menu();
}
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/522051273856197.jpg "#left