如何使用C ++字符串流附加int? [英] How to use C++ String Streams to append int?

查看:119
本文介绍了如何使用C ++字符串流附加int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我或指向我一个简单的例子,如何附加一个int到一个字符串包含单词Something(或任何单词)?

could anyone tell me or point me to a simple example of how to append an int to a stringstream containing the word "Something" (or any word)?

推荐答案

stringstream ss;
ss << "Something" << 42;

以后参考。

http://www.cplusplus.com/reference/iostream/stringstream/

这篇关于如何使用C ++字符串流附加int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆