新手求题目的源代码,各位大神求解啊
c++吧
全部回复
仅看楼主
level 11
//The thread has exited with code.The program has exited with code ERROR.
//1、判断如上字符串中单词的个数
//2、判断重复单词是哪几个
2014年12月10日 01点12分 1
level 11
这是老师的作业
2014年12月10日 01点12分 2
level 1
#include <iostream>
#include <strstream>
#include <hash_map>
#include <string>
using namespace std;
int main(){
char* psz = "The thread has exited with code. The program has exited with code ERROR.";
int iCount = 0;
hash_map<string, int> hm;
istrstream iss(psz);
string str;
while (iss >> str){
hm[str] = hm[str] + 1;
++iCount;
}
cout << "Words count is : " << iCount << endl;
cout << "Repeat the word has : ";
for (hash_map<string, int>::const_iterator it = hm.begin(); it != hm.end(); ++it){
if ((*it).second > 1){
cout << (*it).first << " ";
}
}
cout << endl;
return 0;
}
2014年12月10日 02点12分 3
可是我在VS2013里运行,闪退,是怎么回事
2014年12月10日 10点12分
回复 麻雀的梦想8 :在return语句前面加上 system("PAUSE");
2014年12月10日 14点12分
level 13
[笑眼]  我们无法预知明天的生活,我们更无法安排未来的命运,心灵的自由是我们活着的唯一理由,一定要有希望,哪怕是很小,人生不褪色,心在四季,一路风景。
……来自妞妞真言
2014年12月10日 03点12分 4
1