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();
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
ostringstream对象的put操作参数为char类型。参考本质相当于
put((char)'56')