Thread: how to apply phythagoras theorem to caculate hypotenuse without math.h without header

  1. #1
    Registered User
    Join Date
    Oct 2010

    Unhappy how to apply phythagoras theorem to caculate hypotenuse without math.h without header

    any 1 has solution for it:, In the triangle Pythagoras theorem is used to find out the length of any in known side
    If the base is 4 cm and height is 7cm find out the hypotenuse by using the Pythagoras

    (Hypotenuse) 2 = (base) 2+ (perpendicular )2

    , i need C++ code of it without header file of <math.h> , need to put only conio.h ,iostream.h header file only,

    have done this code:
    void main()
    int base,perp,hyp;
    but i hv to do this solution without math.h header file, then how can i find square root ? any alternate method to solve it without math.h header file please help
    Last edited by amerjamil; 10-29-2010 at 09:28 AM.

  2. #2

  3. #3
    Join Date
    Dec 2007
    OK, now for the next thing to read: << !! Posting Code? Read this First !! >>

  4. #4

  5. #5
    Registered User
    Join Date
    Oct 2010
    rags@ i have read it.. now please try to help me

  6. #6
    Registered User
    Join Date
    Oct 2010
    fronty@ can u please tell me for 65 to calculate square root

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    amerjamil, if you are really lost, then go for a naive but easy to understand and implement solution for integers: increment starting from 0, and square the number. Eventually, the square will be equal to (or greater than) your target number, thus you know that the current number (or previous number) is the square root.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 5
    Last Post: 06-01-2006, 04:37 PM
  3. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

Tags for this Thread