64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
char strBuffer[1024] = "55.5818061829 119.6388702393 22.33";
vector<double> re;
double t;
istringstream iss(strBuffer,strlen(strBuffer));
while(iss >> t)
re.push_back(t);
for(int i=0; i<re.size(); ++i)
cout<<re[i]<<endl;
return 0;
}
int main()
{
char strBuffer[1024] = "55.5818061829 119.6388702393";
istrstream ism(strBuffer,strlen(strBuffer));
double d;
while(ism>>d)
cout<<d<<endl;
return 0;
}
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
char strBuffer[1024] = "55.5818061829 119.6388702393 22.33";
vector<double> re;
double t;
istringstream iss;
iss.str(string(strBuffer));
while(iss >> t)
re.push_back(t);
for(size_t i=0; i<re.size(); ++i)
cout<<re[i]<<endl;
system("pause");
return 0;
}