Hi, I have a homework assignment where I have to ask the user to give 2 points of a graph (a,b) and then I have to find the distance between those two points and the origin. I need to make a function which calculates the distance formula and include that function in the main. So I went to the functions thread and tried to do it and I have many errors which I don't understand so if someone can explain to me what my mistakes are, it'll be great.
Two main errors. The return type of function distance() needs to be floating point. By the way, I'd recommend the use of type double throughout the program, rather than type float. Currently you return an integer, which will lose the fractional part of the result.
Secondly, your code for √(a² + b²) is not correct.