【发布时间】:2016-04-04 09:44:43
【问题描述】:
我想将包含数字浮点数的字符串转换为具有完整有效数字的浮点或双精度数据类型值,请帮我解决这个问题
#include <sstream>
#include<iostream>
#include<string>
using namespace std;
int main()
{
string q = "23.3453535";
float f;
istringstream(q) >>f;
f=1.0*f; // stack-overflow viewer it is an example because i want to process this float value
cout<<f;
}
/*OutPut is:
23.3454
but i want this
23.3453535
*/
【问题讨论】:
标签: c++ string casting type-conversion double