Hi, im new to this and was wondering if anybody could give me a hand in writing a small prog. to handle Pythagoras theorm.I am still at the very early stages and would be very grateful if anyone could help me out.
All the best Rob.
Hi, im new to this and was wondering if anybody could give me a hand in writing a small prog. to handle Pythagoras theorm.I am still at the very early stages and would be very grateful if anyone could help me out.
All the best Rob.
What exactly are you having trouble with? Post your questions (along with your code) here...
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
k1^2 + k2^2 = h^2
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Abrege's 3 Day Introductory Guide to Handling the Pythagoras theorm!
1. Find the squares of the two sides
2. Add them together
3. Use the sqrt() function in math.h to find the square root of sum
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.
or to put what Magos said simpler, a^2 + b^2 = c^2
Note that ^ is in C++ not the operator for power.
use the pow() function in math.h
pow(x, y) calculates the value of x raised to the yth power
i.e
length = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2) );