| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 802 人关注过本帖
标题:生成一个pair对象在VC++6.0无法运行
只看楼主 加入收藏
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
收藏
 问题点数:0 回复次数:0 
生成一个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
搜索更多相关主题的帖子: pair 对象 运行 
2008-09-08 21:54
快速回复:生成一个pair对象在VC++6.0无法运行
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017278 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved