title: Print vector of coordinates obtained from a text file in a specific format in C++
body: <p>The following is the code that I am working on - </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  #include &lt;fstream&gt;
  #include &lt;iterator&gt;
  
  using namespace std;
  
  struct coord {
  long x,y;
  };
  
  int main()
  {
  ifstream nos("numbers.txt");
  vector&lt; long &gt; values;
  double val;
  while ( nos &gt;&gt; val )
  {
      values.push_back(val);
  }
  
  copy(values.begin(), values.end(), ostream_iterator&lt;double&gt;(cout, "\n" ));
  return 0;
  
  }
  </code></pre>
  
  <p>I understand the initial <strong>struct</strong> is not necessary here, but I wish to use that. I want my input text file to be something like this - </p>
  
  <pre><code>1,2
  2,3
  4,5
  </code></pre>
  
  <p>I then use my program, to input these numbers into a <strong>vector</strong> and print out that vector <strong>in the same format</strong></p>
  
  <p>Could anyone tell me what's the correct way of doing so? </p>
  
  <p>I have referred to the <a href="https://stackoverflow.com/questions/10750057/c-printing-out-the-contents-of-a-vector">following</a> for the code, but I need to read and print out in the format mentioned above and I am not sure what's the best way to proceed.</p>
  
  <p>For better clarity - I am attempting to implement a convex hull algorithm. I am trying to get better at programming at the same time and hence such a jump. </p>