Browse Source

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

Blueris 1 month ago
parent
commit
015059c894

+ 31 - 0
ВходнойКонтрольПроваленкоЛН.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35303.130
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ВходнойКонтрольПроваленкоЛН", "ВходнойКонтрольПроваленкоЛН\ВходнойКонтрольПроваленкоЛН.vcxproj", "{2EE1667D-8850-4D37-92A1-D65D503A4A6A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Debug|x64.ActiveCfg = Debug|x64
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Debug|x64.Build.0 = Debug|x64
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Debug|x86.ActiveCfg = Debug|Win32
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Debug|x86.Build.0 = Debug|Win32
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Release|x64.ActiveCfg = Release|x64
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Release|x64.Build.0 = Release|x64
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Release|x86.ActiveCfg = Release|Win32
+		{2EE1667D-8850-4D37-92A1-D65D503A4A6A}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {76F1B1DD-FEB1-4ABC-9562-B88741D57A7E}
+	EndGlobalSection
+EndGlobal

+ 125 - 0
ВходнойКонтрольПроваленкоЛН/dhodnoycontrol.c

@@ -0,0 +1,125 @@
+#include <stdio.h>
+#include <locale.h>
+#include <string.h>
+#include <math.h>
+
+void vvod(int task, float* arguments) {
+    if (task == 1) {
+        printf_s("Ââåäèòå êîýôôèöèåíòû a, b è c: ");
+        while (scanf_s("%f %f %f", &arguments[0], &arguments[1], &arguments[2]) != 3) {
+            printf("Îøèáêà ââîäà. Ïîæàëóéñòà, ââåäèòå òðè ÷èñëà: ");
+            while (getchar() != '\n'); 
+        }
+    }
+    else if (task == 2) {
+        printf_s("Ââåäèòå êîýôôèöèåíòû ñèñòåìû (a1, b1, c1, a2, b2, c2): ");
+        while (scanf_s("%f %f %f %f %f %f", &arguments[0], &arguments[1], &arguments[2],
+            &arguments[3], &arguments[4], &arguments[5]) != 6) {
+            printf_s("Îøèáêà ââîäà. Ïîæàëóéñòà, ââåäèòå øåñòü ÷èñåë: ");
+            while (getchar() != '\n'); 
+        }
+    }
+    else if (task == 3) {
+        printf_s("Ââåäèòå ÷èñëî äëÿ âû÷èñëåíèÿ ôàêòîðèàëà: ");
+        while (scanf_s("%f", &arguments[0]) != 1 || arguments[0] < 0 || arguments[0] != (int)arguments[0]) {
+            printf_s("Îøèáêà ââîäà. Ïîæàëóéñòà, ââåäèòå íåîòðèöàòåëüíîå öåëîå ÷èñëî: ");
+            while (getchar() != '\n'); 
+        }
+    }
+}
+
+void vivod(int task, float* x, int numRoots) {
+    if (task == 1) {
+        if (numRoots == 1) {
+            printf_s("Êîðåíü óðàâíåíèÿ: %.2f\n", x[0]);
+        }
+        else if (numRoots == 2) {
+            printf_s("Êîðíè óðàâíåíèÿ: %.2f\n%.2f\n", x[0], x[1]);
+        }
+        else {
+            printf_s("Íåò äåéñòâèòåëüíûõ êîðíåé.\n");
+        }
+    }
+    else if (task == 2) {
+        printf_s("Ðåøåíèå ñèñòåìû: x = %.2f, y = %.2f\n", x[0], x[1]);
+    }
+    else if (task == 3) {
+        printf_s("Ôàêòîðèàë ÷èñëà %.0f ðàâåí: %.0f\n", x[0], x[1]);
+    }
+}
+
+int Task1(float* arguments, float* x) {
+    float a = arguments[0];
+    float b = arguments[1];
+    float c = arguments[2];
+    float D = b * b - 4 * a * c;
+
+    if (D > 0) {
+        x[0] = (-b + sqrt(D)) / (2 * a);
+        x[1] = (-b - sqrt(D)) / (2 * a);
+        return 2; // Äâà êîðíÿ
+    }
+    else if (D == 0) {
+        x[0] = -b / (2 * a);
+        return 1; // Îäèí êîðåíü
+    }
+    else {
+        return 0; // Íåò äåéñòâèòåëüíûõ êîðíåé
+    }
+}
+
+void Task2(float* arguments, float* x) {
+    float a1 = arguments[0], b1 = arguments[1], c1 = arguments[2];
+    float a2 = arguments[3], b2 = arguments[4], c2 = arguments[5];
+
+    float D = a1 * b2 - a2 * b1;
+
+    if (D != 0) {
+        // Ðåøåíèå ñèñòåìû
+        x[0] = (c1 * b2 - c2 * b1) / D; // x
+        x[1] = (a1 * c2 - a2 * c1) / D; // y
+    }
+    else {
+        printf_s("Ñèñòåìà íå èìååò åäèíñòâåííîãî ðåøåíèÿ.\n");
+    }
+}
+
+float Task3(int n) {
+    if (n == 0 || n == 1) {
+        return 1;
+    }
+    float result = 1;
+    for (int i = 2; i <= n; i++) {
+        result *= i;
+    }
+    return result;
+}
+
+int main() {
+    float arguments[6]; 
+    float roots[2]; // Ìàññèâ äëÿ õðàíåíèÿ êîðíåé
+    int task;
+    setlocale(LC_ALL, "Russian");
+
+    printf_s("Ââåäèòå íîìåð çàäàíèÿ (1 - êâàäðàòíîå óðàâíåíèå, 2 - ñèñòåìà óðàâíåíèé, 3 - ôàêòîðèàë): ");
+    scanf_s("%d", &task);
+
+    vvod(task, arguments);
+
+    if (task == 1) {
+        int numRoots = Task1(arguments, roots);
+        vivod(task, roots, numRoots);
+    }
+    else if (task == 2) {
+        Task2(arguments, roots);
+        vivod(task, roots, 0); 
+    }
+    else if (task == 3) {
+        int n = (int)arguments[0];
+        roots[0] = n; // Ñîõðàíÿåì ÷èñëî äëÿ âûâîäà
+        roots[1] = Task3(n); // Âû÷èñëÿåì ôàêòîðèàë
+        vivod(task, roots, 0); 
+    }
+
+    return 0;
+}

+ 135 - 0
ВходнойКонтрольПроваленкоЛН/ВходнойКонтрольПроваленкоЛН.vcxproj

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{2ee1667d-8850-4d37-92a1-d65d503a4a6a}</ProjectGuid>
+    <RootNamespace>ВходнойКонтрольПроваленкоЛН</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="dhodnoycontrol.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
ВходнойКонтрольПроваленкоЛН/ВходнойКонтрольПроваленкоЛН.vcxproj.filters

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Исходные файлы">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Файлы заголовков">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Файлы ресурсов">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="dhodnoycontrol.c">
+      <Filter>Исходные файлы</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>