关于77页读写string对象编程错误
来源:互联网 发布:苹果公司营销策略数据 编辑:程序博客网 时间:2024/06/05 13:23
编程错误
#include<string.h>#include<iostream>using std::string;using std::cin;using std::cout;using std::endl;int main( ){string s;cin >> s;cout << s << endl;return 0;}
编译器显示
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 conversion)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 conversion)执行 cl.exe 时出错
修改 把#include<string.h>的.h去掉就可以了
运行程序界面
在执行读取操作时,string对象会自动忽略开头的空白(即空格符,换行符,制表符等)并从第一个真正的字符开始读起,直到遇到下一处空白为止。
如上所述,如果程序的输入是“ Hello World ”(注意开头和结尾的空格),则输出将是“Hello”,输出结果中没有任何空格。
阅读全文
0 0
- 关于77页读写string对象编程错误
- 关于string对象的按行读写
- string对象的读写
- string对象的读写
- String对象的读写
- string 对象读写
- 关于string对象
- 基于链表的学生成绩管理系统——C++二进制文件读写string对象时出现的错误
- 关于String对象的疑惑.
- 关于面向对象编程
- 关于面向对象编程
- 关于面向对象编程
- Linux多线程编程之同步对象编程:读写锁
- 关于For input String:"numbers" 的错误
- 网页编程--JavaScript之String对象
- 关于Java String对象创建问题
- 关于Java String对象创建问题解惑
- 关于string创建几个对象的问题
- 说说常见的http状态码
- 笨方法学Python 习题 37: 复习各种符号
- 小程序干掉APP这个结论或许下的太早 但小程序有许多可取之处
- servChannel.register()源码分析
- hdu 6090-Rikka with Graph
- 关于77页读写string对象编程错误
- 解决IE8 内置JSON.stringify,中文变unicode的问题
- 营销思维系列——1
- springboot之过滤器,监听器的使用
- 在VS2013环境下使用EF框架与Sqlite(一)
- Hadoop-No.15之Flume基于事件的数据收集和处理
- 通过 SQL 查询学习 Pandas 数据处理
- Android studio sdk tools 无法更新 cmake和LLDB方法
- Java-Java8