title: Float read as int in C++
body: <p>I have a file in which there are 3 space separated floats on each line. I have written a simple program to read from file and display the read input. But for some reason first value's decimal part is being discarded.</p>
  <p>Code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main(){
  
  ifstream f(&quot;pointcloud.csv&quot;, f.in);
  float x[100], y[100], z[100];
  int i = 0;
  
  for(std::string line; std::getline(f, line); )   //read stream line by line
  {
      std::istringstream in(line);      //make a stream for the line itself
  
  
      in &gt;&gt; x[i] &gt;&gt; y[i] &gt;&gt; z[i++];
      
  }
  
  
  for(int i = 0; i &lt; 100; i++){
      cout  &lt;&lt; x[i] &lt;&lt; &quot; &quot; &lt;&lt; y[i] &lt;&lt; &quot; &quot; &lt;&lt; z[i] &lt;&lt; endl;
  }
  f.close();
  return 0;
  }
  </code></pre>
  <p>Input:</p>
  <pre><code>429372.16 3680107.43 76.91
  429371.55 3680107.73 75.92
  429371.54 3680107.65 75.93
  ...
  </code></pre>
  <p>Output:</p>
  <pre><code>429372 3680107.43 76.91
  429371 3680107.73 75.92
  429371 3680107.65 75.93
  ...
  </code></pre>
  <p>why the decimal part of all X's are missing?</p>