From 413aa7bbc236be62f0d08ffeb35f2b1d44c65d8e Mon Sep 17 00:00:00 2001 From: Kaehvaman Date: Mon, 21 Oct 2024 14:14:55 +0400 Subject: [PATCH] Add lab2 --- lab2/lab2.sln | 31 ++++++++ lab2/lab2/lab2.vcxproj | 136 +++++++++++++++++++++++++++++++++ lab2/lab2/lab2.vcxproj.filters | 22 ++++++ lab2/lab2/main.c | 73 ++++++++++++++++++ 4 files changed, 262 insertions(+) create mode 100644 lab2/lab2.sln create mode 100644 lab2/lab2/lab2.vcxproj create mode 100644 lab2/lab2/lab2.vcxproj.filters create mode 100644 lab2/lab2/main.c diff --git a/lab2/lab2.sln b/lab2/lab2.sln new file mode 100644 index 0000000..eaaee49 --- /dev/null +++ b/lab2/lab2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab2", "lab2\lab2.vcxproj", "{C3B50AE8-C4ED-4032-9919-A738A69F3D48}" +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 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x64.ActiveCfg = Debug|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x64.Build.0 = Debug|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x86.ActiveCfg = Debug|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x86.Build.0 = Debug|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x64.ActiveCfg = Release|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x64.Build.0 = Release|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x86.ActiveCfg = Release|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8F9B036-CAEF-4037-A891-A507AB3EE22A} + EndGlobalSection +EndGlobal diff --git a/lab2/lab2/lab2.vcxproj b/lab2/lab2/lab2.vcxproj new file mode 100644 index 0000000..73bb48c --- /dev/null +++ b/lab2/lab2/lab2.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {c3b50ae8-c4ed-4032-9919-a738a69f3d48} + lab2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab2/lab2/lab2.vcxproj.filters b/lab2/lab2/lab2.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/lab2/lab2/lab2.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab2/lab2/main.c b/lab2/lab2/main.c new file mode 100644 index 0000000..b185146 --- /dev/null +++ b/lab2/lab2/main.c @@ -0,0 +1,73 @@ +#include +#include +#include + +#define PI 3.14159265358979323846 + +void vector_angle() { + float x1, y1, x2, y2; + printf(" \n"); + printf("x1 = "); + scanf_s("%f", &x1); + printf("y1 = "); + scanf_s("%f", &y1); + printf("x2 = "); + scanf_s("%f", &x2); + printf("y2 = "); + scanf_s("%f", &y2); + printf("%.2f ", 57.3 * acos((x1 * x2 + y1 * y2) / (sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2)))); +} + +void lc_freq() { + float L, C; + printf("L = "); + scanf_s("%f", &L); + printf("C = "); + scanf_s("%f", &C); + printf("%.2f ", 1 / (2 * PI * sqrt(L * C))); +} + +void deposit() { + int money, days; + float rate, eff, result; + printf(" %% = "); + scanf_s("%f", &rate); + printf(" = "); + scanf_s("%d", &money); + printf(" = "); + scanf_s("%d", &days); + result = money * pow((1 + (rate / 100) / days), days); + eff = (result - money) / money * 100; + printf(" = %.2f%% = %.2f", eff, result - money); +} + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int num; + printf("1. .\n"); + printf("2. LC-.\n"); + printf("3. .\n"); + + printf(" : "); + scanf_s("%d", &num); + + switch (num) + { + case 1: + vector_angle(); + break; + case 2: + lc_freq(); + break; + case 3: + deposit(); + break; + default: + printf(" !"); + break; + } + + return 0; +} \ No newline at end of file