comp.lang.ada
 help / color / mirror / Atom feed
From: Cedric <Cedric.Lannock@gmx.net>
Subject: Ada Tutor: Outside Assignment 2 - Question to the Solution
Date: Wed, 19 Dec 2012 15:18:00 -0800 (PST)
Date: 2012-12-19T15:18:00-08:00	[thread overview]
Message-ID: <d15786f1-1df6-4cd7-b578-e3e7e42e6942@googlegroups.com> (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



             reply	other threads:[~2012-12-19 23:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 23:18 Cedric [this message]
2012-12-19 23:43 ` Ada Tutor: Outside Assignment 2 - Question to the Solution 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
replies disabled

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