简单的C ++-关于字符串和连接以及将int转换为字符串 [英] Simple C++ - about strings and concatenation and converting int to string
本文介绍了简单的C ++-关于字符串和连接以及将int转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
在C ++中将int转换为字符串的最简单方法
Possible Duplicate:
Easiest way to convert int to string in C++
我对Visual C ++字符串有疑问.我想连接下一个字符串.
I have a question about Visual C++ Strings. I want to concatenate the next string.
for (int i=0; i<23; i++)
{
imagelist.push_back("C:/x/left"+i+".bmp");
imagelist.push_back("C:/x/right"+i+".bmp");
}
Thx
推荐答案
std::ostringstream os;
os << "C:/x/left" << i << ".bmp";
imagelist.push_back(os.str());
这篇关于简单的C ++-关于字符串和连接以及将int转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文