i have a problem of geting a square root in c++ using (cmath)

Hey,

Could you describe the problem? Give us some more info on "what" the problem is?

If you went to a garage with a car and said, "its broken" they wouldnt know what was going on. Same goes here.

post up the

// code that
// your trying to use

Maybe also check the "cmath" #include <cmath> statement?

-Harry

How to use sqrt function in c++ :

int a = 3;
float b = 3;
double c = 3;

float t = sqrt(a); //invalid error. a is of type int. Only float|double allowed
float y = sqrt (  float(a) ); //valid because of typecast
float u = sqrt(b); //valid because b is of type float 
float h = sqrt(c); //valid because c is of type double
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.