| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 635 人关注过本帖
标题:大侠进来帮帮忙,错误提示看不懂................
取消只看楼主 加入收藏
a632034079
Rank: 2
等 级:论坛游民
帖 子:115
专家分:34
注 册:2009-10-3
结帖率:86.11%
收藏
已结贴  问题点数:20 回复次数:2 
大侠进来帮帮忙,错误提示看不懂................
--------------------Configuration: C加加构造函数析构函数 - Win32 Debug--------------------
Compiling...
main.cpp
E:\Windos32\C加加构造函数析构函数\main.cpp(139) : 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 accep
table conversion)
执行 cl.exe 时出错.

C加加构造函数析构函数.exe - 1 error(s), 0 warning(s)
那位大哥帮我解释下上面的错误提示是什么意思啊...................
搜索更多相关主题的帖子: 提示 
2009-12-21 16:11
a632034079
Rank: 2
等 级:论坛游民
帖 子:115
专家分:34
注 册:2009-10-3
收藏
得分:0 
以下是引用debroa723在2009-12-22 00:48:49的发言:

可能如下代码会报这个错:
string str="aaaa";
cout<<str;
如果是这样,我想你使用了如下语句:
#include <iostream.h>
要正确使用就改为
#include<iostream>
using namespace std;
这两个看起一样,其实是不同的, ...
#include<iostream>
using namespace std;
我就这写的啊!为什么还错啊???


#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
class Student
{
public:
    Student(string no,string name,int age)
    {
        stuno = no;
        stuname = name;
        stuage = age;
    }
    void display();
    static string teachername;
private:
    string stuno;
    string stuname;
    int stuage;
};
string Student::teachername = "李老师";
void Student::display()
{
    cout << "班主任:" << teachername << endl;
    cout << "名字:" << stuname << "学号:" << stuno << "年龄:" << stuage << endl;
}
int main()
{
    Student stud1("1000","NC",20);
    stud1.display();
    Student stud2("1001","SB",12);
    stud2.display();
    cin.get();
    return 0;
}

郁闷!老错那个地方.................
2009-12-22 15:35
a632034079
Rank: 2
等 级:论坛游民
帖 子:115
专家分:34
注 册:2009-10-3
收藏
得分:0 
原来#include <string.h>的.h是不要的啊!怪不得老错............
2009-12-22 15:46
快速回复:大侠进来帮帮忙,错误提示看不懂................
数据加载中...
 
   



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

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