标题:关于string类(奇怪的问题)
取消只看楼主
primary
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-9-9
 问题点数:0 回复次数:1 
关于string类(奇怪的问题)
请教大家:
#include<iostream>
#include<string.h>
using namespace std;
void main(void)
{
 string s1("dfdf");
 cout<<s1;
}

可以说都是书上的原版,但是却有以下的错误提示:
 error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conver
sion)

很不明白,有些方面的书上也表示可以这样输出的!唉!可能是个很菜的问题,但连老师都
解决不了!!
编译环境:visual c++
os:windows xp professional
请大家多多指教
搜索更多相关主题的帖子: string 
2005-10-15 17:39
primary
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-9-9
得分:0 
谢谢你的帮助!呵呵!
的确可以啊!
但是你说的stl是什么啊?不明白!
可以解说一下吗?

Great Hope Makes Great Man!
2005-10-15 22:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-30277-1-1.html




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

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