Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Seminars/Seminar08/self/self.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task01", "task01\task01.csproj", "{88BB153C-53E8-4752-BC4F-196C19CBC945}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task02", "task02\task02.csproj", "{997D8020-AA7C-44C7-A64E-9DE732DC55B3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task03", "task03\task03.csproj", "{4DCCBE76-E0A0-44C8-A628-DD9F56D4A24C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task04_01", "task04\task04_01.csproj", "{65D8C0C9-43B1-40B4-832D-BB71AA22CEDF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task04_02", "task04_02\task04_02.csproj", "{6EBC5B45-777C-4627-9D2E-476D60C78C4D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "task04_03", "task04_03\task04_03.csproj", "{AB40A587-2EAE-4529-B3D4-CB3C8476BBD5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "task04_04", "task04_04\task04_04.csproj", "{BB92B088-CAB2-43B5-AEBD-54D2E977E532}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88BB153C-53E8-4752-BC4F-196C19CBC945}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88BB153C-53E8-4752-BC4F-196C19CBC945}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88BB153C-53E8-4752-BC4F-196C19CBC945}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88BB153C-53E8-4752-BC4F-196C19CBC945}.Release|Any CPU.Build.0 = Release|Any CPU
{997D8020-AA7C-44C7-A64E-9DE732DC55B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{997D8020-AA7C-44C7-A64E-9DE732DC55B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{997D8020-AA7C-44C7-A64E-9DE732DC55B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{997D8020-AA7C-44C7-A64E-9DE732DC55B3}.Release|Any CPU.Build.0 = Release|Any CPU
{4DCCBE76-E0A0-44C8-A628-DD9F56D4A24C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DCCBE76-E0A0-44C8-A628-DD9F56D4A24C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DCCBE76-E0A0-44C8-A628-DD9F56D4A24C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DCCBE76-E0A0-44C8-A628-DD9F56D4A24C}.Release|Any CPU.Build.0 = Release|Any CPU
{65D8C0C9-43B1-40B4-832D-BB71AA22CEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65D8C0C9-43B1-40B4-832D-BB71AA22CEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65D8C0C9-43B1-40B4-832D-BB71AA22CEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65D8C0C9-43B1-40B4-832D-BB71AA22CEDF}.Release|Any CPU.Build.0 = Release|Any CPU
{6EBC5B45-777C-4627-9D2E-476D60C78C4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EBC5B45-777C-4627-9D2E-476D60C78C4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EBC5B45-777C-4627-9D2E-476D60C78C4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EBC5B45-777C-4627-9D2E-476D60C78C4D}.Release|Any CPU.Build.0 = Release|Any CPU
{AB40A587-2EAE-4529-B3D4-CB3C8476BBD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB40A587-2EAE-4529-B3D4-CB3C8476BBD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB40A587-2EAE-4529-B3D4-CB3C8476BBD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB40A587-2EAE-4529-B3D4-CB3C8476BBD5}.Release|Any CPU.Build.0 = Release|Any CPU
{BB92B088-CAB2-43B5-AEBD-54D2E977E532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB92B088-CAB2-43B5-AEBD-54D2E977E532}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB92B088-CAB2-43B5-AEBD-54D2E977E532}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB92B088-CAB2-43B5-AEBD-54D2E977E532}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {78270E97-CABB-4D1D-AC4B-12CB6662FA30}
EndGlobalSection
EndGlobal
79 changes: 79 additions & 0 deletions Seminars/Seminar08/self/task01/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace task01
{
internal class Program
{
static double[] P1()
{
double a = 0;
double b = 0;
double k = 0;
double sum = 0;
double sum1 = 0;
do
{
k++;
double sum2 = 0;
sum1 = sum1 + 1 / k;
sum2 = sum1 * 1 / (Math.Pow(k + 1, 3));
sum = sum + sum2;
a = b;
b = sum;
} while (b - a > double.Epsilon);
double[] ar = new double[2] { Math.Pow(360 * sum, 1.0 / 4), k };
return ar;
}
static double[] P2()
{
double a = 0;
double b = 0;
double i = 0;
double sum = 0;
do
{
sum = sum + Math.Pow(16, -i) * (4 / (8 * i + 1) - 2 / (8 * i + 4) - 1 / (8 * i + 5) - 1 / (8 * i + 6));
a = b;
b = sum;
i++;
} while (b - a > double.Epsilon);
double[] ar = new double[2] { sum, i };
return ar;
}
static void Main(string[] args)
{
do
{
try
{

Console.Write("Введите номер выбранного метода: ");
int n = int.Parse(Console.ReadLine());
if (n == 1)
{
double[] arg = new double[2];
arg = P1();
Console.WriteLine($"Приближенное значение = {arg[0]}, кол-во итераций = {arg[1]}");
}
else if (n == 2)
{
double[] arg = new double[2];
arg = P2();
Console.WriteLine($"Приближенное значение = {arg[0]}, кол-во итераций = {arg[1]}");
}
else
{
Console.WriteLine("Введены некорретные данные");
}
Console.WriteLine("Для выхода из программы нажмите Escape");

}
catch (FormatException)
{
Console.WriteLine("Введены некорректные данные");
}
} while (Console.ReadKey().Key != ConsoleKey.Escape);
}
}
}
10 changes: 10 additions & 0 deletions Seminars/Seminar08/self/task01/task01.csproj
Original file line number Diff line number Diff line change
@@ -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>
45 changes: 45 additions & 0 deletions Seminars/Seminar08/self/task02/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace task02
{
internal class Program
{
public static bool Triangle(double x, double y, double z, out double p, out double s)
{
if (!(x + y > z && x + z > y && z + y > x) || x<=0 || y<=0 || z<=0)
{
p = 0;
s = 0;
return false;
}
else
{
p = x + y + z;
double p1 = p / 2;
s = Math.Sqrt(p1 * (p1 - x) * (p1 - y) * (p1 - x));
return true;
}
}
static void Main(string[] args)
{
try
{
Console.WriteLine("Введите x, y, z");
double x = double.Parse(Console.ReadLine());
double y = double.Parse(Console.ReadLine());
double z = double.Parse(Console.ReadLine());
bool f=Triangle(x, y, z, out double p, out double s);
if (f)
{
Console.WriteLine($"периментр = {p}, площадь = {s}");
}
else
{
Console.WriteLine("Введены неподходящие данные");
}
}
catch (FormatException)
{
Console.WriteLine("Введены некорректные данные");
}
}
}
}
10 changes: 10 additions & 0 deletions Seminars/Seminar08/self/task02/task02.csproj
Original file line number Diff line number Diff line change
@@ -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>
100 changes: 100 additions & 0 deletions Seminars/Seminar08/self/task03/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System.Data.SqlTypes;
using System.Security.Cryptography;

namespace task03
{
internal class Program
{
public static bool Shift(int shiftCount, ref char c)
{
char[] ABC = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'G', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
char[] abc = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
char[] RABC = { 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я' };
char[] rabc = { 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'ч', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я' };
if (Array.IndexOf(ABC, c)!=-1)
{
int n = Array.IndexOf(ABC, c);
shiftCount = shiftCount % 26;
n = (n + shiftCount) % 26;
if (n < 0)
{
c = ABC[26 + n];
}
else
{
c = ABC[n];
}
return true;
}
else if (Array.IndexOf(abc, c) != -1)
{
int n = Array.IndexOf(abc, c);
shiftCount = shiftCount % 26;
n = (n + shiftCount) % 26;
if (n < 0)
{
c = abc[26 + n];
}
else
{
c = abc[n];
}
return true;
}
else if (Array.IndexOf(RABC, c) != -1)
{
int n = Array.IndexOf(RABC, c);
shiftCount = shiftCount % 33;
n = (n + shiftCount) % 33;
if (n < 0)
{
c = RABC[33 + n];
}
else
{
c = RABC[n];
}
return true;
}
else if (Array.IndexOf(rabc, c) != -1)
{
int n = Array.IndexOf(rabc, c);
shiftCount = shiftCount % 33;
n = (n + shiftCount) % 33;
if (n < 0)
{
c = rabc[33 + n];
}
else
{
c = rabc[n];
}
return true;
}

else
{
return false;
}
}
static void Main(string[] args)
{
try
{
Console.WriteLine("Введите символ и кол-во позиций для сдвига");
char c = char.Parse(Console.ReadLine());
int shiftCount = int.Parse(Console.ReadLine());
bool f=Shift(shiftCount, ref c);
if (f)
{
Console.WriteLine($"Полученное значение = {c}");
}
}
catch (FormatException)
{
Console.WriteLine("Введены некорретные значения");
}

}
}
}
10 changes: 10 additions & 0 deletions Seminars/Seminar08/self/task03/task03.csproj
Original file line number Diff line number Diff line change
@@ -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>
64 changes: 64 additions & 0 deletions Seminars/Seminar08/self/task04/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System.Security.Cryptography;

namespace task04_01
{
internal class Program
{
static void SummIt(double a, double b, out int count, out int summ)
{
int a1 = (int)Math.Truncate(a);
int b1 = (int)Math.Truncate(b);
count = 0;
summ = 0;
for (int i = a1; i <= b1; i++)
{
if (i <= 0)
{
continue;
}
else
{
string s = i.ToString();
if (s.Contains("0"))
{
count += 1;
summ += i;
}
}
}
}
static void TotalSumm(double a, double b, out int summ)
{
int a1 = (int)Math.Truncate(a);
int b1 = (int)Math.Truncate(b);
summ = 0;
for (int i = a1; i <= b1; i++)
{
if (i <= 0)
{
continue;
}
else
{
summ += i;
}
}
}
static void Main(string[] args)
{
try
{
Console.WriteLine("Введите A и B");
double a = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
TotalSumm(a, b, out int summ1);
SummIt(a, b, out int count, out int summ2);
Console.WriteLine($"Значение вычислений - {Math.Abs(summ1-summ2)}");
}
catch (FormatException)
{
Console.WriteLine("Введены некорректные значения");
}
}
}
}
Loading