コード例 #1
0
 public Triangle()
 {
     a = 1;
     b = 1;
     c = 1;
     type = triangleType.equilateral;
 }
コード例 #2
0
 private void calculateType()
 {
     if (a == c && b == c)
         type = triangleType.equilateral;
     else if (a == b || a == c || b == c)
         type = triangleType.isosceles;
     else
         type = triangleType.scalene;
 }
コード例 #3
0
 private bool isTriangle()
 {
     if (a <= 0 || b <= 0 || c <= 0) {
         this.type = triangleType.notATriangle;
         return false;
     } else {
         if (((a + b) > c) && ((a + c) > b) && ((b + c) > a)) {
             return true;
         } else {
             this.type = triangleType.notATriangle;
             return false;
         }
     }
 }