comp.lang.ada
 help / color / mirror / Atom feed
* Ada Tutor: Outside Assignment 2 - Question to the Solution
@ 2012-12-19 23:18 Cedric
  2012-12-19 23:43 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cedric @ 2012-12-19 23:18 UTC (permalink / raw)


Hi All,

I try to learn Ada using Ada Tutor (http://zhu-qy.blogspot.de/2012/08/adatutor.html). I tried the excerise of the outside assignment 2 and do not understand the given solution.

The test driver says that the tests

  Compare( 2,  4,  6, Not_A_Triangle);
  Compare( 1,  3,  2, Not_A_Triangle);
  Compare( 3,  1,  2, Not_A_Triangle);
  Compare( 1,  2,  4, Not_A_Triangle);
  Compare( 1,  4,  2, Not_A_Triangle);
  Compare( 4,  1,  2, Not_A_Triangle);

  Compare( 3,  3,  7, Not_A_Triangle);
  Compare( 3,  7,  3, Not_A_Triangle);
  Compare( 6,  3,  3, Not_A_Triangle);

do not define a valid triangle. The solution says

      if Len1 + Len2 <= Len3  or Len1 + Len3 <= Len2
         or Len2 + Len3 <= Len1  then
         Answer := Not_A_Triangle;

and 

You must have realized by now that it's impossible to draw a triangle with sides 1, 2, and 3.  The sum of any two sides must be greater than the third.

What is the exact mathematic definition of a triangle? My last math course a quick a while ago :(

I would assume that a triangle formed by 1, 2 and 3 would give a valid triangle. Why should that not be the case?

Regards

Cedric



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-20 11:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 23:18 Ada Tutor: Outside Assignment 2 - Question to the Solution Cedric
2012-12-19 23:43 ` Georg Bauhaus
2012-12-20  0:15 ` Adam Beneschan
2012-12-20  9:13   ` Manuel Collado
2012-12-20  9:27     ` Georg Bauhaus
2012-12-20 11:16 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox