c++ 字符串和数字拼接
2024-08-31 07:54:54
方法一:
#include <iostream>
#include <string>
#include <sstream>
using
namespace
std;
int
main()
{
int
a = 2;
string b =
"abc"
;
stringstream ss;
ss << a << b;
cout << ss.str() << endl;
return
0;
}
方法二:
#include <iostream>
using namespace std;
int main()
{
int a = 6;
char b[10];
sprintf_s(b, "abc%d", a);
cout << b << endl;
system("pause");
return 0;
}
最新文章
- HTML5- Canvas入门(五)
- Apache的详细安装教程和遇到的问题解决方案
- 线程的Alertable与User APC
- Qt for Mac 安装(包括PyQt)
- 使用Monkey进行压力测试
- Strange Problem O(∩_∩)O~
- figure元素
- 使用hue+oozi构建任务调度系统
- yarn的调度策略
- 如何在Azure Websites中配置PHP从而改变系统默认时区
- Cisco CatOS系统交换机的SPAN配置
- 如何安装(装载)axure组件(部件)
- LeetCode &; Q189-Rotate Array-Easy
- ASP.NET MVC上传文件
- (转)SQLServer_十步优化SQL Server中的数据访问五
- idea连接mysql
- Springboot &; Mybatis 构建restful 服务三
- glassfish SEC5054: Certificate has expired
- Nginx – rewrite 配置 URL重写及301跳转原理图
- JavaScript 记录页面停留时间-通过测试