I am having issues with my C++.

It's another "search the web for your answers" class. WTF am I going to school for?

/*

Newton-Raphson Method

convert from supplied Java format to C++ format

*/

#include <iostream>

#include <cmath>

using namespace std;

class Lab1

{

public:

double getValue();

double getInitialGuess( double value );

double approximateSqrt( double value );

};

/*

getValue method asks user for value greater than zero.

method also checks to verify value is greater than zero.

*/

double Lab1::getValue()

{

double value;

cout<<"Enter value (>0): "<<endl;

cin>>value;

while( value <= 0 )

{

cout<<"Invalid value "<<value<<" <= 0 -- try again"<<endl;

cout<<"Enter value (>0): "<<endl;

cin>>value;

}

return value;

} // end getValue method

/*

getInitialGuess method calculates value for

approximateSqrt method.

*/

double Lab1::getInitialGuess( double value )

{

return ( value / 2.0 );

} // end getInitialGuess method

/*

approximateSqrt method approximates the sqare root

of the entered value.

*/

double Lab1::approximateSqrt( double value )

{

const double epsilon = 0.00001;

double x = getInitialGuess( value );

printf( "sqrt( %1.6f ) = %1.6f\n", value, x );

while ( abs( value - x * x ) > epsilon )

{

double tx = x;

x = 0.5 * ( x + ( value / x ));

printf( "sqrt( %1.6f ) = 0.5 * ( %1.6f + ( %1.6f / %1.6f ) ) = %1.6f\n", value, tx, value, tx, x );

}

return x;

} // end approximateSqrt method

int main()

{

cout<<"Enter value whos square root will be computed"<<endl;

double x = getValue();

double xSqrt = approximateSqrt( x );

printf("\n sqrt( %1.6f ) = %1.6f \n", x, xSqrt);

return 0;

} // end main

Problem is, I have no experience with C++. I don't think/know if the way I declared my methods is correct. TA has had two classes so far which were over the meanings of ++, --, && and || :shock: Stuff I actually knew from two quarters ago.

This is supposed to be due for lab on Monday.

The formulas are correct. The TA gave us the Java code. We just have to convert it into C++.

Errors I am getting:

error C3861: 'getValue': identifier not found

error C3861: 'approximateSqrt': identifier not found