Thread: Pythagoras theorm

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    Smile Pythagoras theorm

    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.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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]

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    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.

  4. #4
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    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.

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    or to put what Magos said simpler, a^2 + b^2 = c^2

  6. #6
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Note that ^ is in C++ not the operator for power.

  7. #7
    Shadow12345
    Guest
    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) );

Popular pages Recent additions subscribe to a feed