你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

C++字符串流用法

2021/12/11 20:43:50
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	int b,c=1234;
	double d;
	stringstream tio;
	cin >> a;
	tio << a;
	tio >> b;
	tio >> d;
	b+=c;
	cout << b << endl << d << endl;
	return 0;
}

以上代码便可实现类型转换