隔一段时间不写就忘记函数是什么了,今日记下,以作查询。

#include<iostream>
using namespace std;

string str;

int aint;
long long alonglong;
float afloat;
double adouble;

int main()
{
	
	str = "1";
	aint = stoi(str);
	cout<<aint<<endl;
	
	cout<<~(1<<31)<<endl;
	str = "214748364700";
	alonglong = stoll(str);
	cout<<alonglong<<endl;
	
	str = "23.4";
	afloat = stof(str);
	cout<<afloat<<endl;
	
	str = "6718234.32432";
	adouble = stod(str);
	cout<<adouble<<endl;
	return 0;
}

c++ string 转 int longlong float double

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-22
  • 2021-10-12
  • 2021-11-02
  • 2021-09-18
  • 2022-12-23
  • 2021-05-30
相关资源
相似解决方案