Bladeren bron

isDefective

Андрей Морозов 2 jaren geleden
bovenliggende
commit
c788d9b5f0
2 gewijzigde bestanden met toevoegingen van 11 en 3 verwijderingen
  1. 10 3
      Exam/Program.cs
  2. 1 0
      Exam/ReadData.cs

+ 10 - 3
Exam/Program.cs

@@ -18,11 +18,18 @@ namespace Exam
         {
             Tubes[] tube = new Tubes[0];
             tube = ReadData.Read("data.txt", ref tube);
-            int i = 1;
-            foreach (Tubes tub in tube)
+
+            double[] diameters = new double[] { 20, 25, 32, 40, 50, 63 };
+
+            for (int i = 0; i < tube.Length; i++)
             {
-                Console.WriteLine(i++ + " " + tub.name + " " + tub.isReinforced);
+                if (!(3960 <= tube[i].length && tube[i].length >= 4040))
+                {
+                    tube[i].isDefective = true;
+                }
             }
+
+            
         }
     }
 }

+ 1 - 0
Exam/ReadData.cs

@@ -34,6 +34,7 @@ namespace Exam
                 {
                     arr[i].isReinforced = true;
                 }
+                arr[i].isDefective = false;
                 i++;
             }
             return arr;