[ create a new paste ] login | about

Link: http://codepad.org/35BkUYNz    [ raw code | output | fork ]

C++, pasted on Jan 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
   std::string str="R 7.2 531.804 119.479 0.477472 175.792 " 
                   "7.22212 -64.2461 0 79.5401 -0.600769 "
                   "77.957 0 0.982318 0 0 3.708 0";

   std::stringstream stream (str);
   std::vector<double> v;
   char c;

   stream >> c;
   std::copy (std::istream_iterator<double>(stream), std::istream_iterator<double>(), std::back_inserter(v));
   std::copy (v.begin(), v.end(), std::ostream_iterator<double>(std::cout, " "));
}


Output:
1
7.2 531.804 119.479 0.477472 175.792 7.22212 -64.2461 0 79.5401 -0.600769 77.957 0 0.982318 0 0 3.708 0 


Create a new paste based on this one


Comments: