c++编写程序,输入几行文本,并打印一个表格,此表格按照单词在文本中出现顺序,显示不同单词出现次数

2025-05-11 19:54:46
推荐回答(4个)
回答1:


#include

#include

#include

#include

using namespace std;

map mMap;

int main(){


std::string str;

while(cin >> str)

{

mMap[str]++;

map::const_iterator t;

for (t = mMap.begin(); t != mMap.end(); t++){


cout << t->first << " " << t->second << endl;


}

}

return 0;

}

回答2:

可是最后运行的答案却是重复了多次

回答3:

我可以写 可以写

回答4:

属地管理速度快股票是 枯