rootTesterResidual

rootTesterResidual - double root = squareRoot(x, eps); cout...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//======================================== //rootTesterResidual.cpp // Code to test my second square root function. //======================================== #include  #include  using namespace std; double squareRoot(double x, double eps); //=====================>> main << ============== int main(void) { cout.precision(15); //resolution of digits shown double x; double eps; cout<< "Input x and the desired residual [q to quit]:> "; cin >>x; cin >>eps; while(not cin.fail()) { //we have valid input, so give it a try
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double root = squareRoot(x, eps); cout << " squareRoot("<<x<<", "="" <<eps<<")=";<br> cout <<root<<endl;<br> cout<<" sqrt("="" <<x<<="" ")=" <<sqrt(x)<<endl;<br> cout<<" difference=" << root-sqrt(x)<<endl;<br> cout<<" residual="<<root*root-x<<endl;<br> cout<<" =="=================================="<<endl;<br"> cout<<"Input x and the desired residual [q to quit]:> "; cin>>x; cin>>eps; } cout<< "Thanks for playing!" <<endl; return 0; }</endl; </x<<",>...
View Full Document

This note was uploaded on 11/07/2011 for the course EE 150 taught by Professor Dr.burke during the Fall '08 term at USC.

Page1 / 2

rootTesterResidual - double root = squareRoot(x, eps); cout...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online