0
点赞
收藏
分享

微信扫一扫

C++11 字符串转换函数

在觉 2022-01-09 阅读 50

一、转换函数


二、举个栗子


1、

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char ** argv)
{
	string a = "123";
	string b = "123.4";

	int c = stoi(a);
	float d = stof(b);
	string e = to_string(c);

	cout << c << endl;
	cout << d << endl;
	cout << e << endl;

	return 0;
}

 

三、_End


1

举报

相关推荐

0 条评论