Ejemplo n.º 1
0
int main()
{
  StopWatch TotalTimer;
  TotalTimer.StartTimer();
  int i = 0;
  Work(i);
  TotalTimer.StopTimer();
  std::cout << "Time_Total: " << TotalTimer.GetElapsedSeconds() << std::flush << std::endl;
}
Ejemplo n.º 2
0
/**
 * \brief Program to compute PI using brute force a niave algorithm.
 */
int main(int argc, const char * argv[])
{

  std::cout << "Calculating pi by computing the of 1/4 unit-circle." << std::endl;

  StopWatch PiTimer;
  PiTimer.StartTimer();
  const double areaUnitCircle = CaluculatePiByEstimatingUnitCircleArea(50000);
  PiTimer.StopTimer();

  std::cout << std::setprecision(17) ;
  std::cout << "Accurate   PI = " << pi() << std::endl;
  std::cout << "Calculated PI = " << areaUnitCircle << std::endl;
  std::cout << "ERROR         = " << areaUnitCircle - pi() << std::endl;
  std::cout << "Seconds       = " << PiTimer.GetElapsedSeconds() << std::endl;
  return EXIT_SUCCESS;
}