一小段程序,~不明白为什么会有这么多错误?

xyxcg 2003-05-15 11:15:31
# include <iostream>
# include <string>
# include <map>
# include <set>
# include <algorithm>
# include <fstream>

using namespace std;
void Initializeset(set<string>&);

void CreateMap( map<string,int> & _crmp,const set<string> & _ft);

void DispMap(const map<string,int> & _stmp);

void StorageMapToFile( map<string,int> &);

void main()
{
set<string> filter;

Initializeset(filter);

map<string,int> storagemap;

CreateMap(storagemap,filter);

DispMap(storagemap);

StorageMapToFile(storagemap);

}

void InitializeSet( set<string> & _ft)
{
static string InitArray[]={"a","an","the","but","or","and","to","go"};

_ft.insert(InitArray,InitArray+8);
}

void CreateMap( map<string,int> & _crmp,const set<string> & _ft)
{
ifstream input_file("test.txt");

string tword;
while ( input_file >> tword )
{
if ( _ft.count(tword) )
continue;
_crmp[tword]++;
}

}

void DispMap(const map<string,int> &_stmp)
{
map<string,int>::iterator iter=_stmp.begin(),end_it=_stmp.end();

for (;iter != end_it ; ++iter)
{
cout <<"String Key is :" <<iter->first <<" "
<<"String Value is :" <<iter->second <<" "<<endl;
}
}

void MapStorageToFile( map<string,int> &_mstf)
{
ofstream out_file("output.file");

map<string,int>::iterator iter=_mstf.begin();

for ( ; iter!=_mstf.end(); ++iter )
{
out_file <<"String Key is : " <<iter->first <<" "
<<"String Value is : " <<iter->second <<" " <<endl;
}
}

...全文
76 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
happy2program 2003-05-16
换用stlport吧
回复
zliang520 2003-05-16
在VC6下还有一个错误c2440,查了一下是说不能够进行转换所造成的,是不是由于vc6的
版本较低的问题?
回复
lifanxi 2003-05-15
C4786警告,解决方案是在程序开始处加上
#pragma warning(disable:4786)
详细的解释见:
http://expert.csdn.net/Expert/topic/1410/1410599.xml?temp=7.456607E-02
回复
xyxcg 2003-05-15

有几百个类似错误

f:\programtool\microsoft visual studio\vc98\include\xtree(120) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::set<std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::
basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
回复
相关推荐
发帖
工具平台和程序库
创建于2007-09-28

2.4w+

社区成员

C/C++ 工具平台和程序库
申请成为版主
帖子事件
创建了帖子
2003-05-15 11:15
社区公告
暂无公告