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();
}
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();
}
8 回答6.5k 阅读
4 回答685 阅读✓ 已解决
3 回答838 阅读✓ 已解决
2 回答3.4k 阅读
3 回答1.9k 阅读✓ 已解决
1 回答2.1k 阅读✓ 已解决
1 回答2.1k 阅读✓ 已解决
ostringstream
对象的put
操作参数为char
类型。参考