文章详情页
java - C++ ostringstream问题
浏览:199日期:2024-02-07 14:57:32
问题描述
include <iostream>include <sstream>using namespace std;int main(){
ostringstream ostr('abcd');ostr.put(’1’);cout<<ostr.str();cout<<endl;ostr<<'hi';ostr.put(’56’); ///这边为何不是输出1bc56 而是1bc6?cout<<ostr.str();
}
问题解答
回答1:ostringstream对象的put操作参数为char类型。参考
回答2:本质相当于put((char)’56’)
标签:
java
相关文章:
1. angular.js - Web应用,单页面应用Cache问题2. android - webview 自定义加载进度条3. position:absolute、float、display:inline-block 都能实现相同效果,区别是什么?4. android - 如何缩小APK的体积5. css3 - 这个效果用 CSS 可以实现吗?border-image6. javascript - vue更改当前节点元素7. vue.js - vue 打包后 nginx 服务端API请求跨域问题无法解决。8. angular.js - angular post的Content-Type被设置,导致不能上传图片,求助!!9. docker-compose 为何找不到配置文件?10. mac连接阿里云docker集群,已经卡了2天了,求问?
排行榜

网公网安备