From ff734768d7f7842b0ec5a1595ea8d0605257574e Mon Sep 17 00:00:00 2001 From: Serg Date: Mon, 27 Dec 2021 16:36:20 +0300 Subject: [PATCH 1/6] Lesson4 --- Lesson4Task1/Lesson4Task1.sln | 34 +++++++++++ Lesson4Task1/Lesson4Task1/App.config | 6 ++ Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj | 60 +++++++++++++++++++ Lesson4Task1/Lesson4Task1/Program.cs | 49 +++++++++++++++ .../Lesson4Task1/Properties/AssemblyInfo.cs | 36 +++++++++++ Lesson4Task1/Lesson4Task2/App.config | 6 ++ Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj | 60 +++++++++++++++++++ Lesson4Task1/Lesson4Task2/Program.cs | 28 +++++++++ .../Lesson4Task2/Properties/AssemblyInfo.cs | 36 +++++++++++ Lesson4Task1/Lesson4Task3/App.config | 6 ++ Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj | 60 +++++++++++++++++++ Lesson4Task1/Lesson4Task3/Program.cs | 45 ++++++++++++++ .../Lesson4Task3/Properties/AssemblyInfo.cs | 36 +++++++++++ 13 files changed, 462 insertions(+) create mode 100644 Lesson4Task1/Lesson4Task1.sln create mode 100644 Lesson4Task1/Lesson4Task1/App.config create mode 100644 Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj create mode 100644 Lesson4Task1/Lesson4Task1/Program.cs create mode 100644 Lesson4Task1/Lesson4Task1/Properties/AssemblyInfo.cs create mode 100644 Lesson4Task1/Lesson4Task2/App.config create mode 100644 Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj create mode 100644 Lesson4Task1/Lesson4Task2/Program.cs create mode 100644 Lesson4Task1/Lesson4Task2/Properties/AssemblyInfo.cs create mode 100644 Lesson4Task1/Lesson4Task3/App.config create mode 100644 Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj create mode 100644 Lesson4Task1/Lesson4Task3/Program.cs create mode 100644 Lesson4Task1/Lesson4Task3/Properties/AssemblyInfo.cs diff --git a/Lesson4Task1/Lesson4Task1.sln b/Lesson4Task1/Lesson4Task1.sln new file mode 100644 index 0000000..7ce1614 --- /dev/null +++ b/Lesson4Task1/Lesson4Task1.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task1", "Lesson4Task1\Lesson4Task1.csproj", "{90A706D9-A902-4A1A-902D-A6465E512452}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task2", "Lesson4Task2\Lesson4Task2.csproj", "{59E6A54D-6F6E-4D7E-97F9-C40C27960E53}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task3", "Lesson4Task3\Lesson4Task3.csproj", "{17F02508-4588-4573-A18F-231847270931}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {90A706D9-A902-4A1A-902D-A6465E512452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90A706D9-A902-4A1A-902D-A6465E512452}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90A706D9-A902-4A1A-902D-A6465E512452}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90A706D9-A902-4A1A-902D-A6465E512452}.Release|Any CPU.Build.0 = Release|Any CPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53}.Release|Any CPU.Build.0 = Release|Any CPU + {17F02508-4588-4573-A18F-231847270931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17F02508-4588-4573-A18F-231847270931}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17F02508-4588-4573-A18F-231847270931}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17F02508-4588-4573-A18F-231847270931}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Lesson4Task1/Lesson4Task1/App.config b/Lesson4Task1/Lesson4Task1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj new file mode 100644 index 0000000..855aa1b --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {90A706D9-A902-4A1A-902D-A6465E512452} + Exe + Properties + Lesson4Task1 + Lesson4Task1 + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task1/Program.cs b/Lesson4Task1/Lesson4Task1/Program.cs new file mode 100644 index 0000000..56ed497 --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/Program.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +/* + * Написать метод GetFullName(string firstName, string lastName, string patronymic), принимающий на вход ФИО в разных аргументах и возвращающий объединённую строку с ФИО. + * Используя метод, написать программу, выводящую в консоль 3–4 разных ФИО. + * */ +namespace Lesson4Task1 +{ + class Program + { + static string GetFullName(string firstName, string lastName, string patronymic) + { + string[] FIO = { firstName, lastName, patronymic }; + string Result = string.Join(" ", FIO); + return Result; + } + static string GetWordFromUser(string What) + { + Console.WriteLine(What); + string Result = Console.ReadLine(); + return Result; + } + static string GetFIO() + { + string Name = GetWordFromUser("Введите Имя: "); + string LastName = GetWordFromUser("Введите Фамилию: "); + string Patronymic = GetWordFromUser("Введите Отчество: "); + string FIO = GetFullName(Name, LastName, Patronymic); + return FIO; + } + static void Main(string[] args) + { + Console.WriteLine("Давайте познакомимся!"); + string YouFIO = GetFIO(); + Console.WriteLine($"Здравствуйте, уважаемый {YouFIO}!"); + Console.WriteLine("Представте вашего друга."); + string Frend1 = GetFIO(); + Console.WriteLine("Представте вашего второго друга."); + string Frend2 = GetFIO(); + Console.WriteLine("Представте вашу подругу."); + string GirlFrend = GetFIO(); + Console.WriteLine($"Приятно познакомиться, уважаемый {Frend1},\nуважаемый {Frend2},\nуважаемая {GirlFrend}."); + } + } +} diff --git a/Lesson4Task1/Lesson4Task1/Properties/AssemblyInfo.cs b/Lesson4Task1/Lesson4Task1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..769921e --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lesson4Task1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Lesson4Task1")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("90a706d9-a902-4a1a-902d-a6465e512452")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Lesson4Task1/Lesson4Task2/App.config b/Lesson4Task1/Lesson4Task2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj new file mode 100644 index 0000000..4d75b9d --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53} + Exe + Properties + Lesson4Task2 + Lesson4Task2 + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task2/Program.cs b/Lesson4Task1/Lesson4Task2/Program.cs new file mode 100644 index 0000000..e48f987 --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/Program.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +/* + * +Написать программу, принимающую на вход строку — набор чисел, разделенных пробелом, и возвращающую число — сумму всех чисел в строке. +Ввести данные с клавиатуры и вывести результат на экран. + * */ +namespace Lesson4Task2 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите строку целых чисел через пробел."); + string inputStr = Console.ReadLine(); + string[] Nums = inputStr.Split(' '); + int sum = 0; + foreach(var snum in Nums) + { + sum += Int32.Parse(snum); + } + Console.WriteLine($"Сумма всех чисел= {sum}"); + } + } +} diff --git a/Lesson4Task1/Lesson4Task2/Properties/AssemblyInfo.cs b/Lesson4Task1/Lesson4Task2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6cd734f --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lesson4Task2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Lesson4Task2")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("59e6a54d-6f6e-4d7e-97f9-c40c27960e53")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Lesson4Task1/Lesson4Task3/App.config b/Lesson4Task1/Lesson4Task3/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj new file mode 100644 index 0000000..351ceb0 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {17F02508-4588-4573-A18F-231847270931} + Exe + Properties + Lesson4Task3 + Lesson4Task3 + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task3/Program.cs b/Lesson4Task1/Lesson4Task3/Program.cs new file mode 100644 index 0000000..d0fea88 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/Program.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +/* + * +Написать метод по определению времени года. На вход подаётся число – порядковый номер месяца. +На выходе — значение из перечисления (enum) — Winter, Spring, Summer, Autumn. +Написать метод, принимающий на вход значение из этого перечисления и возвращающий название времени года (зима, весна, лето, осень). +Используя эти методы, ввести с клавиатуры номер месяца и вывести название времени года. +Если введено некорректное число, вывести в консоль текст «Ошибка: введите число от 1 до 12». + + * */ + +namespace Lesson4Task3 +{ + public enum Seasons + { + Winter =2, + Spring = 5, + Summer = 8, + Autumn = 11 + } + static Seasons GetSeason(int month) + { + } + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите номер месяца: "); + string numMonth = Console.ReadLine(); + int month = Int32.Parse(numMonth); + while (month < 0 || month > 12) + { + Console.WriteLine("Ошибка: введите число от 1 до 12!"); + numMonth = Console.ReadLine(); + month = Int32.Parse(numMonth); + } + + } + } +} diff --git a/Lesson4Task1/Lesson4Task3/Properties/AssemblyInfo.cs b/Lesson4Task1/Lesson4Task3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d9d64a2 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lesson4Task3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Lesson4Task3")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("17f02508-4588-4573-a18f-231847270931")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] From 5dee11732f85d44ac43398803b426abf96c88a6a Mon Sep 17 00:00:00 2001 From: Serg Date: Tue, 28 Dec 2021 17:01:57 +0300 Subject: [PATCH 2/6] Task3 finish --- Lesson4Task1/Lesson4Task3/Program.cs | 67 +++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/Lesson4Task1/Lesson4Task3/Program.cs b/Lesson4Task1/Lesson4Task3/Program.cs index d0fea88..996a1ec 100644 --- a/Lesson4Task1/Lesson4Task3/Program.cs +++ b/Lesson4Task1/Lesson4Task3/Program.cs @@ -16,29 +16,74 @@ Написать метод по определению времени года. namespace Lesson4Task3 { - public enum Seasons - { - Winter =2, - Spring = 5, - Summer = 8, - Autumn = 11 - } - static Seasons GetSeason(int month) - { - } class Program { + public enum Seasons + { + Winter, + Spring, + Summer, + Autumn + } + /* static Seasons GetSeason(int month) + { + Seasons[] yea = { Seasons.Winter, Seasons.Winter, Seasons.Spring, Seasons.Spring, Seasons.Spring, Seasons.Summer, Seasons.Summer, Seasons.Summer, + Seasons.Autumn, Seasons.Autumn, Seasons.Autumn, Seasons.Winter }; + } + */ + static Seasons GetSeason(int month) + { + Seasons Result = 0; + switch(month) + { + case 12: + case 1: + case 2: + Result = Seasons.Winter; + break; + + case 3: + case 4: + case 5: + Result = Seasons.Spring; + break; + + case 6: + case 7: + case 8: + Result = Seasons.Summer; + break; + + case 9: + case 10: + case 11: + Result = Seasons.Autumn; + break; + } + return Result; + } + + static string GetSeasonRus(Seasons season) + { + string[] seasonsRus = { "Зима", "Весна", "Лето", "Осень", }; + string Result = seasonsRus[(int)season]; + return Result; + } + static void Main(string[] args) { Console.WriteLine("Введите номер месяца: "); string numMonth = Console.ReadLine(); int month = Int32.Parse(numMonth); - while (month < 0 || month > 12) + while (month < 1 || month > 12) { Console.WriteLine("Ошибка: введите число от 1 до 12!"); numMonth = Console.ReadLine(); month = Int32.Parse(numMonth); } + Seasons season = GetSeason(month); + string sName = GetSeasonRus(season); + Console.WriteLine($"Это {sName}"); } } From 59740de665a3dc231e12d8e7db4184a031da3b01 Mon Sep 17 00:00:00 2001 From: Serg Date: Fri, 31 Dec 2021 13:43:33 +0300 Subject: [PATCH 3/6] Task4 --- Lesson4Task1/Lesson4Task1.sln | 6 ++ Lesson4Task1/Lesson4Task4/App.config | 6 ++ Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj | 60 +++++++++++++++++++ Lesson4Task1/Lesson4Task4/Program.cs | 31 ++++++++++ .../Lesson4Task4/Properties/AssemblyInfo.cs | 36 +++++++++++ 5 files changed, 139 insertions(+) create mode 100644 Lesson4Task1/Lesson4Task4/App.config create mode 100644 Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj create mode 100644 Lesson4Task1/Lesson4Task4/Program.cs create mode 100644 Lesson4Task1/Lesson4Task4/Properties/AssemblyInfo.cs diff --git a/Lesson4Task1/Lesson4Task1.sln b/Lesson4Task1/Lesson4Task1.sln index 7ce1614..b9ffa3e 100644 --- a/Lesson4Task1/Lesson4Task1.sln +++ b/Lesson4Task1/Lesson4Task1.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task2", "Lesson4Task EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task3", "Lesson4Task3\Lesson4Task3.csproj", "{17F02508-4588-4573-A18F-231847270931}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson4Task4", "Lesson4Task4\Lesson4Task4.csproj", "{0AB9ED87-1196-41FE-A505-69C49C4D5AEF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {17F02508-4588-4573-A18F-231847270931}.Debug|Any CPU.Build.0 = Debug|Any CPU {17F02508-4588-4573-A18F-231847270931}.Release|Any CPU.ActiveCfg = Release|Any CPU {17F02508-4588-4573-A18F-231847270931}.Release|Any CPU.Build.0 = Release|Any CPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Lesson4Task1/Lesson4Task4/App.config b/Lesson4Task1/Lesson4Task4/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj new file mode 100644 index 0000000..245c711 --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF} + Exe + Properties + Lesson4Task4 + Lesson4Task4 + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lesson4Task1/Lesson4Task4/Program.cs b/Lesson4Task1/Lesson4Task4/Program.cs new file mode 100644 index 0000000..3ea40c2 --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/Program.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lesson4Task4 +{ + class Program + { + static int CalcFib(int what) + { + int Result = 0; + if (what < 1) + return 0; + if (what == 1) + return 1; + + Result = CalcFib(what - 1) + CalcFib(what - 2); + Console.WriteLine($" {Result}, "); + return Result; + } + static void Main(string[] args) + { + Console.WriteLine("Введите положительное число для вывода ряда Фибоначчи:"); + int input = int.Parse(Console.ReadLine()); + Console.WriteLine("ряд Фибоначчи:"); + CalcFib(input); + } + } +} diff --git a/Lesson4Task1/Lesson4Task4/Properties/AssemblyInfo.cs b/Lesson4Task1/Lesson4Task4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8003992 --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lesson4Task4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Lesson4Task4")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0ab9ed87-1196-41fe-a505-69c49c4d5aef")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] From e5730b2d6842d64ab4cce82ee73573e7caf7f177 Mon Sep 17 00:00:00 2001 From: Sah19-coder Date: Sun, 2 Jan 2022 19:41:48 +0300 Subject: [PATCH 4/6] Task4 --- Lesson4Task1/Lesson4Task4/App.config | 6 +++--- Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj | 3 ++- Lesson4Task1/Lesson4Task4/Program.cs | 14 ++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Lesson4Task1/Lesson4Task4/App.config b/Lesson4Task1/Lesson4Task4/App.config index 88fa402..4bfa005 100644 --- a/Lesson4Task1/Lesson4Task4/App.config +++ b/Lesson4Task1/Lesson4Task4/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj index 245c711..d58915a 100644 --- a/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj +++ b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj @@ -9,9 +9,10 @@ Properties Lesson4Task4 Lesson4Task4 - v4.5.2 + v4.8 512 true + AnyCPU diff --git a/Lesson4Task1/Lesson4Task4/Program.cs b/Lesson4Task1/Lesson4Task4/Program.cs index 3ea40c2..7932bd3 100644 --- a/Lesson4Task1/Lesson4Task4/Program.cs +++ b/Lesson4Task1/Lesson4Task4/Program.cs @@ -8,16 +8,14 @@ namespace Lesson4Task4 { class Program { - static int CalcFib(int what) + static int CalcFib(int n) { - int Result = 0; - if (what < 1) - return 0; - if (what == 1) + + if (n < 2) return 1; - - Result = CalcFib(what - 1) + CalcFib(what - 2); - Console.WriteLine($" {Result}, "); + + int Result = CalcFib(n - 1) + CalcFib(n - 2); + Console.Write($" {Result}, "); return Result; } static void Main(string[] args) From 4661efe1b11403cb85277d7e9abc84f63f5c0b69 Mon Sep 17 00:00:00 2001 From: Sah19-coder Date: Sun, 2 Jan 2022 19:42:23 +0300 Subject: [PATCH 5/6] Task4 fix --- Lesson4Task1/Lesson4Task1/App.config | 6 +++--- Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj | 3 ++- Lesson4Task1/Lesson4Task2/App.config | 6 +++--- Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj | 3 ++- Lesson4Task1/Lesson4Task3/App.config | 6 +++--- Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Lesson4Task1/Lesson4Task1/App.config b/Lesson4Task1/Lesson4Task1/App.config index 88fa402..4bfa005 100644 --- a/Lesson4Task1/Lesson4Task1/App.config +++ b/Lesson4Task1/Lesson4Task1/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj index 855aa1b..0e69f40 100644 --- a/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj +++ b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj @@ -9,9 +9,10 @@ Properties Lesson4Task1 Lesson4Task1 - v4.5.2 + v4.8 512 true + AnyCPU diff --git a/Lesson4Task1/Lesson4Task2/App.config b/Lesson4Task1/Lesson4Task2/App.config index 88fa402..4bfa005 100644 --- a/Lesson4Task1/Lesson4Task2/App.config +++ b/Lesson4Task1/Lesson4Task2/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj index 4d75b9d..d06dc4a 100644 --- a/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj +++ b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj @@ -9,9 +9,10 @@ Properties Lesson4Task2 Lesson4Task2 - v4.5.2 + v4.8 512 true + AnyCPU diff --git a/Lesson4Task1/Lesson4Task3/App.config b/Lesson4Task1/Lesson4Task3/App.config index 88fa402..4bfa005 100644 --- a/Lesson4Task1/Lesson4Task3/App.config +++ b/Lesson4Task1/Lesson4Task3/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj index 351ceb0..1f70da0 100644 --- a/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj +++ b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj @@ -9,9 +9,10 @@ Properties Lesson4Task3 Lesson4Task3 - v4.5.2 + v4.8 512 true + AnyCPU From 2b0f63aeb1d0b9a8b72ca61f890125afe96fa51d Mon Sep 17 00:00:00 2001 From: Sah19-coder Date: Sun, 2 Jan 2022 19:48:58 +0300 Subject: [PATCH 6/6] CalcFib --- Lesson4Task1/Lesson4Task4/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lesson4Task1/Lesson4Task4/Program.cs b/Lesson4Task1/Lesson4Task4/Program.cs index 7932bd3..239f11f 100644 --- a/Lesson4Task1/Lesson4Task4/Program.cs +++ b/Lesson4Task1/Lesson4Task4/Program.cs @@ -15,15 +15,15 @@ static int CalcFib(int n) return 1; int Result = CalcFib(n - 1) + CalcFib(n - 2); - Console.Write($" {Result}, "); + // Console.Write($" {Result}, "); return Result; } static void Main(string[] args) { - Console.WriteLine("Введите положительное число для вывода ряда Фибоначчи:"); + Console.WriteLine("Введите положительное число для вывода Фибоначчи:"); int input = int.Parse(Console.ReadLine()); - Console.WriteLine("ряд Фибоначчи:"); - CalcFib(input); + Console.WriteLine("Число Фибоначчи:"); + Console.Write($" {CalcFib(input)} "); } } }