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.

This is a discussion on *Pythagoras theorm* within the **C++ Programming** forums, part of the General Programming Boards category; Hi, im new to this and was wondering if anybody could give me a hand in writing a small prog. ...

- 12-05-2002 #1

- Join Date
- Dec 2002
- Posts
- 1

## 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.

- 12-05-2002 #2
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]

- 12-05-2002 #3
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.

- 12-05-2002 #4
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 sumI am against the teaching of evolution in schools. I am also against widespread

literacy and the refrigeration of food.

- 12-05-2002 #5

- Join Date
- Nov 2002
- Posts
- 1,109

or to put what Magos said simpler, a^2 + b^2 = c^2

- 12-06-2002 #6

- Join Date
- Aug 2001
- Location
- Groningen (NL)
- Posts
- 2,386

Note that ^ is in C++ not the operator for power.

- 12-06-2002 #7Shadow12345Guest
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) );

- Exactly how to get started with C++ (or C) today
- C Tutorial
- C++ Tutorial
- 5 ways you can learn to program faster
- The 5 Most Common Problems New Programmers Face
- How to set up a compiler
- 8 Common programming Mistakes
- What is C++11?
- Creating a game, from start to finish

- How to create a shared library on Linux with GCC - December 30, 2011
- Enum classes and nullptr in C++11 - November 27, 2011
- Learn about The Hash Table - November 20, 2011
- Rvalue References and Move Semantics in C++11 - November 13, 2011
- C and C++ for Java Programmers - November 5, 2011
- A Gentle Introduction to C++ IO Streams - October 10, 2011