How to use C++ String Streams to append int?

Goles picture Goles · Jan 14, 2010 · Viewed 32.4k times · Source

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)?

Answer

Daniel A. White picture Daniel A. White · Jan 14, 2010
stringstream ss;
ss << "Something" << 42;

For future reference, check this out.

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