Selaa lähdekoodia

Добавьте файлы проекта.

МорозовАВ 2 vuotta sitten
vanhempi
commit
b1b9376ae8
5 muutettua tiedostoa jossa 205 lisäystä ja 0 poistoa
  1. 25 0
      Exam.sln
  2. 100 0
      Exam/DataFiles/data.txt
  3. 10 0
      Exam/Exam.csproj
  4. 28 0
      Exam/Program.cs
  5. 42 0
      Exam/ReadData.cs

+ 25 - 0
Exam.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32526.322
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exam", "Exam\Exam.csproj", "{DD6F4EB1-7F9C-4FC5-A35D-BBEE1413BA92}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DD6F4EB1-7F9C-4FC5-A35D-BBEE1413BA92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DD6F4EB1-7F9C-4FC5-A35D-BBEE1413BA92}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DD6F4EB1-7F9C-4FC5-A35D-BBEE1413BA92}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DD6F4EB1-7F9C-4FC5-A35D-BBEE1413BA92}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {129D4455-26B8-4CC0-B647-D01024E19F6A}
+	EndGlobalSection
+EndGlobal

+ 100 - 0
Exam/DataFiles/data.txt

@@ -0,0 +1,100 @@
+PN10;3982;24,946;2,866;
+PN10;3971;50,237;5,591;
+PN10;4059;32,287;3,503;
+PN10;4036;32,329;3,054;
+PN10;3930;49,398;5,054;
+PN10;4053;31,841;3,390;
+PN10;3975;19,860;1,904;A
+PN10;3996;32,038;3,360;
+PN10;4003;63,514;7,145;
+PN10;4035;19,809;2,126;
+PN10;4063;49,845;4,863;
+PN10;3979;62,848;6,840;
+PN10;4034;32,467;3,066;
+PN10;3979;20,197;2,242;
+PN10;3955;25,175;2,536;
+PN10;3950;31,645;3,587;
+PN10;3953;63,040;6,837;
+PN10;3966;62,289;6,019;A
+PN10;3938;63,430;6,548;
+PN10;3963;25,099;2,760;
+PN10;3935;25,112;2,570;
+PN10;4043;40,271;3,814;
+PN10;3930;39,825;4,400;
+PN10;3947;63,851;6,244;
+PN10;4077;40,122;5,336;
+PN16;3945;20,147;2,798;
+PN16;4008;32,244;4,199;A
+PN16;3977;40,566;5,766;
+PN16;4066;31,698;4,168;
+PN16;3959;19,926;2,722;A
+PN16;3948;49,281;6,683;A
+PN16;3927;32,341;4,608;
+PN16;3923;20,085;2,630;
+PN16;3924;24,776;3,313;A
+PN16;3933;63,627;8,763;
+PN16;4004;20,153;2,636;
+PN16;4030;40,450;5,399;A
+PN16;3967;62,660;8,472;
+PN16;3997;32,065;4,392;
+PN16;4074;49,710;6,718;
+PN16;3939;40,478;5,393;
+PN16;4014;49,741;7,087;A
+PN16;3988;25,238;3,485;
+PN16;4071;19,844;2,820;
+PN16;3952;39,952;5,444;A
+PN16;3974;25,190;3,532;
+PN16;3945;19,954;2,697;
+PN16;4023;50,311;6,753;
+PN16;3999;32,144;4,400;
+PN16;3926;63,346;8,967;
+PN20;4061;40,244;6,991;
+PN20;4065;39,744;6,842;
+PN20;4011;32,118;5,295;
+PN20;4048;49,696;8,317;A
+PN20;3954;24,901;4,139;
+PN20;3979;19,954;3,461;A
+PN20;4009;39,960;6,866;A
+PN20;4025;20,065;3,358;
+PN20;3952;20,114;3,440;
+PN20;3946;25,151;4,139;A
+PN20;3992;19,838;3,250;
+PN20;3951;39,593;6,758;A
+PN20;3963;40,522;6,765;
+PN20;4058;32,173;5,121;A
+PN20;3952;20,286;3,433;A
+PN20;3954;20,150;3,209;
+PN20;4005;25,219;4,198;
+PN20;3940;40,372;6,450;A
+PN20;4036;50,312;8,037;
+PN20;4069;63,485;10,198;
+PN20;4004;49,382;7,971;
+PN20;4029;62,439;10,519;
+PN20;3961;50,727;8,643;
+PN20;3968;40,554;6,839;A
+PN20;4080;20,031;3,411;
+PN25;4021;20,100;3,486;A
+PN25;4038;39,752;6,413;A
+PN25;3945;49,263;8,299;A
+PN25;4065;19,932;3,435;A
+PN25;4060;25,072;4,340;A
+PN25;4063;31,867;5,473;A
+PN25;3959;20,230;3,441;A
+PN25;3938;50,223;8,548;A
+PN25;4004;62,309;10,537;A
+PN25;3979;20,153;3,206;A
+PN25;3994;31,655;5,557;A
+PN25;4035;25,200;4,150;A
+PN25;3997;49,295;8,051;
+PN25;3991;32,478;5,502;A
+PN25;3944;39,493;6,638;A
+PN25;4068;19,821;3,304;
+PN25;3934;20,039;3,417;A
+PN25;4033;63,017;10,910;
+PN25;3968;20,046;3,350;A
+PN25;4014;62,603;10,080;A
+PN25;4057;24,791;4,117;A
+PN25;3977;40,109;6,970;A
+PN25;4012;49,395;8,121;A
+PN25;3922;19,843;3,371;A
+PN25;3940;25,350;4,168;A

+ 10 - 0
Exam/Exam.csproj

@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 28 - 0
Exam/Program.cs

@@ -0,0 +1,28 @@
+using System;
+
+namespace Exam
+{
+    class program
+    {
+        public struct Tubes
+        {
+            public string name;
+            public int length;
+            public double diameter, thickness;
+            public bool isDefective, isReinforced;
+        }
+
+        Tubes[] tube = new Tubes[0];
+
+        static void Main(string[] args)
+        {
+            Tubes[] tube = new Tubes[0];
+            tube = ReadData.Read("data.txt", ref tube);
+            int i = 1;
+            foreach (Tubes tub in tube)
+            {
+                Console.WriteLine(i++ + " " + tub.name + " " + tub.isReinforced);
+            }
+        }
+    }
+}

+ 42 - 0
Exam/ReadData.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Exam
+{
+    internal class ReadData
+    {
+        static public program.Tubes[] Read(string path, ref program.Tubes[] arr)
+        {
+            if (!File.Exists(path))
+            {
+                Console.WriteLine("Файла не существует!");
+                Environment.Exit(0);
+            }
+            var lines = File.ReadAllLines(path);
+            int i = 0;
+            foreach (var line in lines)
+            {
+                Array.Resize(ref arr, arr.Length + 1);
+                string[] parts = line.Split(";");
+                arr[i].name = parts[0];
+                arr[i].length = Convert.ToInt32(parts[1]);
+                arr[i].diameter = Convert.ToDouble(parts[2]);
+                arr[i].thickness = Convert.ToDouble(parts[3]);
+                if (String.IsNullOrEmpty(parts[4]))
+                {
+                    arr[i].isReinforced = false;
+                }
+                else
+                {
+                    arr[i].isReinforced = true;
+                }
+                i++;
+            }
+            return arr;
+        }
+    }
+}