title: fibonacci print out issue in c++
body: <p>I was trying to run the fib.exe by using this command "fib 12" so it can directly print out the result in this format:
  <a href="http://pastebin.com/ytR92i8f" rel="nofollow">http://pastebin.com/ytR92i8f</a></p>
  
  <p>But with my code compiled, for instance, if I use 12 to test my program, it won' t read any number and show the result in this command "fib xx" but it will run the program and let you type the number you want in the next line  and then print out the result...</p>
  
  <p>I have attached the link to my main.cpp below as reference.</p>
  
  <p>main.cpp :      <a href="http://pastebin.com/fhUAkNQR" rel="nofollow">http://pastebin.com/fhUAkNQR</a></p>
  
  <p>Because main.c can not be modify so I can only use one function to get it works.
  Right now I already have the correct result.</p>
  
  <pre><code>void fibonacci(int max)
  {
  
  do
  {
    std::cin &gt;&gt; max;
  } 
  while(max &lt; 2 &amp;&amp; max &gt; 46);  
  
  std::cout &lt;&lt; "           Fibonacci        Fibonacci" &lt;&lt; std::endl;
  std::cout &lt;&lt; " N           number          quotient" &lt;&lt; std::endl;
  std::cout &lt;&lt; "-------------------------------------" &lt;&lt; std::endl;
  std::cout &lt;&lt; " 0             0                  N/A" &lt;&lt; std::endl;
  std::cout &lt;&lt; " 1             1                  N/A" &lt;&lt; std::endl;
  
  int count = max;
  int fib1 = 0, fib2 = 1;
  
  for (int i = 2; i &lt;= count; i++)
  {
    int next = fib1 + fib2;
  
    // Add statements to print here...
    std::cout &lt;&lt; std::setw(2) &lt;&lt; i;
    std::cout &lt;&lt; std::setw(14) &lt;&lt; next;
    std::cout &lt;&lt; std::setw(21) &lt;&lt; std::setprecision(17) &lt;&lt; std::showpoint;
    std::cout &lt;&lt; static_cast&lt;double&gt;(next) / fib2 &lt;&lt; std::endl;
    std::cout.unsetf(std::ios_base::showpoint);
  
    fib1 = fib2;
    fib2 = next;
  }
  
  
  return;
  </code></pre>
  
  <p>}</p>