#include <iostream>
#include <string>
using namespace std;
#include <set>
int main()
{
multiset<string> arr;
string s;
cin>>s;
while(s!="#")
{
int times=0;
times=arr.count(s);
cout<<"times:"<<times<<endl;
arr.insert(s);
cin>>s;
}
}
编写一个程序,从键盘上输入一个个单词,每接收到一个单词后,输出该单词是否曾经出现过以及出现次数。可以尝试分别用多重集合(multiset)或映射(map)两种途径实现,将二者进行比较。本题答案你可以任
本文介绍了一个C++程序,利用`multiset`容器实现对用户输入字符串的计数功能,直到用户输入#为止。
或映射(map)两种途径实现,将二者进行比较。本题答案你可以任&spm=1001.2101.3001.5002&articleId=134761874&d=1&t=3&u=139680bc4b67448ba40a9fc00b709815)
2711





