Андрей Морозов 2 gadi atpakaļ
vecāks
revīzija
b5a6e2f238
1 mainītis faili ar 15 papildinājumiem un 4 dzēšanām
  1. 15 4
      Exam/Program.cs

+ 15 - 4
Exam/Program.cs

@@ -17,8 +17,6 @@ namespace Exam
             Tubes[] tube = new Tubes[0];
             tube = ReadData.Read("data.txt", tube);
 
-            
-
             double[] diameters = new double[] { 20.000, 25.000, 32.000, 40.000, 50.000, 63.000 };
 
             for (int i = 0; i < tube.Length; i++)
@@ -42,12 +40,10 @@ namespace Exam
                         if (!(startRange <= tube[i].diameter && tube[i].diameter <= endRange))
                         {
                             check = false;
-                            Console.WriteLine(i + 1 + " " + startRange + " " + endRange);
                         }
                         else
                         {
                             check = true;
-                            Console.WriteLine(i + 1 + " " + startRange + " " + endRange);
                             break;
                         }
                     }
@@ -57,6 +53,21 @@ namespace Exam
                     }
                 }
             }
+
+            for (int i = 0; i < tube.Length; i++)
+            {
+                if (!tube[i].isDefective)
+                {
+                    startRange = tube[i].diameter / 100.0 * 10;
+                    endRange = tube[i].diameter / 100.0 * 11;
+
+                    if (!(startRange <= tube[i].thickness && tube[i].thickness <= endRange))
+                    {
+                        tube[i].isDefective = true;
+                    }
+                    //Console.WriteLine(i + 1 + " " + startRange  + " " + tube[i].thickness + " " + endRange + " " + tube[i].isDefective);
+                }
+            }
         }
     }
 }