/** @file sample for formatted output of floating point
 *
 * Last CVS checkin:
 * $Date: $
 * $Author: scheff $
 */

/**************************************************************************/

// standard C/C++ header:
#include <iostream>
#include <string>

/**************************************************************************/

using namespace std;

/** waits for user confirm.
 *
 * @param action text with next action
 */
static void pause(const char *action)
{
  cout << "Press [ENTER] to " << action << ": " << flush;
  string str; getline(cin, str);
}

/** provides the main function of application.
 *
 * @param argc number of command line arguments
 * @param argv pointer to array of pointers to strings with command line
 *        arguments
 * @return 0 ... application exited regularly\n
 *         else ... execution of application aborted
 */
int main(int argc, char *argv[])
{
  pause("start");
  // print floating points as is
  double value1 = 1.0, value2 = 1.0; int i = 0;
  for (;;) {
    cout << '\t' << value1 << '\t' << value2 << endl;
    { double value = value1; value1 *= 0.1; if (value == value1) break; }
    { double value = value2; value2 *= 10.0; if (value == value2) break; }
    if (++i == 10) { pause("continue"); i = 0; }
  }
  // done
  pause("finish");
  return 0;
}

