| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 766 人关注过本帖
标题:各位高手能不能帮我看下哪错了?不胜感激啊
只看楼主 加入收藏
韩雨航
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2012-1-12
结帖率:57.14%
收藏
 问题点数:0 回复次数:2 
各位高手能不能帮我看下哪错了?不胜感激啊
#include<iostream>
#include<algorithm>
using namespace std;
void main()
{
    string a,s1="hello";
    string s2="123";
    a=s1;                                        //复制
    cout<<(a==s1 ?"":"not ")<<"equal"<<endl;        //比较
    cout<<a+=s2<<endl;                            //连接
    reverse(a.begin(),a.end());                    //倒置串
    cout<<a<<endl;
    cout<<a.replace(0,9,9,'c')<<endl;            //设置
    cout<<(s1.find("ell")!=-1?"":"not")<<"found"<<endl;    //查找串
    cout<<(s1.find('c')!=-1?"":"not")<<"found"<<endl;    //查找字符
}


E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const short *)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from 'class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const unsigned char)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from '
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const unsigned char *)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from
 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const signed char)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from 'cl
ass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const signed char *)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from '
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,_E)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from 'class std::basic_
string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const _E *)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &' from 'class std
::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
E:\程序\string字符串操作.cpp(10) : error C2676: binary '<<' : 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' does not define this operator or a conversion to a type acceptable to the predefined operator
E:\程序\string字符串操作.cpp(12) : 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 conversio
n)
E:\程序\string字符串操作.cpp(13) : 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 conversio
n)
执行 cl.exe 时出错.

string字符串操作.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: void 不胜感激 include hello 
2012-01-13 00:14
BianChengNan
Rank: 8Rank: 8
等 级:贵宾
威 望:13
帖 子:302
专家分:972
注 册:2011-11-30
收藏
得分:0 
#include<string>

我的群:149544757 C/C++/Assembly 喜欢交流的朋友进,进群请写消息
2012-01-19 19:08
韩雨航
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2012-1-12
收藏
得分:0 
谢谢~~
2012-01-20 20:26
快速回复:各位高手能不能帮我看下哪错了?不胜感激啊
数据加载中...
 
   



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

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