legendcong

string和int的相互转换方法

2018-09-09 21:02  legend聪  阅读(234)  评论(0编辑  收藏  举报

string转为int

string str = "100000";
	stringstream ss;
	ss << str;
	int i;
	ss >> i;
	printf("%d", i);

int转为string

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m = 1000;
	string str = to_string(m);
	cout << str;
}

  

分类:

技术点:

相关文章:

  • 2021-09-13
  • 2021-09-13
  • 2021-09-19
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案