title: how to use stringstream to convert a string to an int and to a double at the same time
body: <p>How do I convert a string into an int and a double using stringstream?</p>
  
  <p>the input is going to be four digits followed by a period followed by another four digits (####.####) and i need to extract the first four digits into an int and then the whole thing needs to be a double, but im not sure where to go from here</p>
  
  <pre><code>    string s;
      cin &gt;&gt; s;
      stringstream ss;
      ss &lt;&lt; s;
      int num1; // needs to be int
      ss.str(s);
      ss &gt;&gt; num1;
      ss.clear();
      ss &lt;&lt; s;
      double num2; // needs to be a double
      ss &gt;&gt; num2;
  </code></pre>
  
  <p>For example, let's say we have <code>1234.5678</code> in the input. After the reading happens, I want to have <code>1234</code> in <code>num1</code>, and <code>1234.5678</code> in <code>num2</code>.</p>