Re: simple program

From: YouKnowMe (comp_at_home.net)
Date: 01/29/04


Date: Thu, 29 Jan 2004 16:12:12 -0000


"Karl Heinz Buchegger" <kbuchegg@gascad.at> wrote in message
news:4017FEEC.2A40AE1C@gascad.at...
> youknowme wrote:
> >
> > Please can you tell me if this program will work? I have not been able
to
> > compile and run it myself as yet because i need to learn how to use my
new
> > compiler & emacs.
> >
> > This program is from Dietel & Deitel exercise 2.35:
> > "Write a program that reads three nonzero double values and determines
and
> > prints if they could represent the sides of a triangle".
> >
> > - Basically if the values for at least two sides are the same, triangle
=
> > true, else false??
>
> That logic is faulty.
> A triangle with sides 3 4 and 5 forms a perfectly right angled triangle
and
> yet none 2 sides have the same length.
>
> Make some scetches on paper to refine your logic. First of all you
> need to think about the question: What does a triangle look like, that
> no longer is a triangle although it consists of 3 sides and the endpoints
> of the sides are connected correctly.
>
> Eg. Is this a triangle?
>
> +---------------+-------------+
>
> A B C
>
>
> (Hard to draw with ASCII graphics. There are 3 lines
> from A to B
> B C
> A C
>
> How can you detect that case?
>
>
> --
> Karl Heinz Buchegger
> kbuchegg@gascad.at

I understand this but this exercise is definately to test the values for a
equal sided triangle. The next exercise in my book 2.36 is writing a program
for a right angled triangle. As you have already given me hints on this, i
will post the question here:

'2.36 Write a program that reads three non zero integers and determines and
prints if they could be the sides of a right triangle.'

Is my logic for exercise 2.35 ok, assuming that the question is asking for
values of a equal triangle?? Once i have done this program, i will try to
figure out how to program the right angle triangle problem.

But can you please look at the first problem for me again?