您的位置:首页 > 编程语言 > C语言/C++

c++ 输出string的问题 cout << string

2010-02-22 11:12 435 查看
us.name = "123";


cout << us.name << endl;





=====================================



程序运行时报一个异常



C2679: binary '<<' : no operator defined which takes a right-hand operand of type





错误原因:在#include<iostream.h>中string类没有重载"<<"操作符.





cout << us.name.c_str() << endl;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: