#include<iostream>#include<string>using namespace std;class person{public: string name; int count;}array[3]={"li",0,"zhang",0,"sun",0};int main(){ string name1; cout<<"输入人名"<<endl; int i,j; for(i=0;i<10;i++) { cin>>name1; for(j=0;j<3;j++) { if(name1==array[j].name)array[j].count++ } } for(i=0;i<3;i++) {cout<<array[i].name<<":"<<array[i].count<<endl; } return 0;}
1 回答
- 1 回答
- 0 关注
- 1192 浏览
添加回答
举报
0/150
提交
取消