// lab02c.cc Demonstrate library square root, and user defined square root
// P. Conrad 9/30/2005 (note: substitute your own name and date in your code)
//                    

// the following two lines allow stream input and output
using namespace std;
#include <iostream>

// the following line allows use of math library, including sqrt
#include <cmath>

// ************ user defined functions ***********

double approxSquareRoot(double x)
{
  // insert code here to approximate square root of x
  // stop and return when guess * guess is within 0.01% of x
  
  // temporarily, always return 1.0.  Remove the next line of code
  // and this comment when you are finished coding your algorithm

  return 1.0;  // temporary return statement

}

// ************ main program  ************

int main(void)
{
  // declare a variable for user supplied number
  double numSuppliedByUser;

  // prompt for and read input
  cout << "Please enter a number: " << flush;
  cin >> numSuppliedByUser;

  // output result, and end program

  cout << "Square root of your number: \n"
       << "  library sqrt result    : " << sqrt(numSuppliedByUser) << "\n"
       << "  approxSquareRoot result: " << approxSquareRoot(numSuppliedByUser) 
       << endl;

  return 0; // ends the main program

}


















