生成一个pair对象在VC++6.0无法运行
#include <iostream>#include <string>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
void main()
{
pair<string,int> anon;
string first,last;
while(cin>>first>>last)
{
anon=make_pair(first,last);
if (first==""||last=="")
break;
}
}
如下错误请高手回答一下
d:\vc98\include\utility(23) : error C2440: 'initializing' : cannot convert from 'const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
E:\电子图书\VC制作\C测试\cs1.cpp(13) : see reference to function template instantiation '__thiscall std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int>::std::pair<class std::basic_string<cha
r,struct std::char_traits<char>,class std::allocator<char> >,int>(const struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::al
locator<char> > > &)' being compiled
d:\vc98\include\utility(23) : error C2439: 'second' : member could not be initialized
d:\vc98\include\utility(26) : see declaration of 'second'
E:\电子图书\VC制作\C测试\cs1.cpp(13) : see reference to function template instantiation '__thiscall std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int>::std::pair<class std::basic_string<cha
r,struct std::char_traits<char>,class std::allocator<char> >,int>(const struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::al
locator<char> > > &)' being compiled