diff --git a/Lesson4Task1/Lesson4Task1.sln b/Lesson4Task1/Lesson4Task1.sln new file mode 100644 index 0000000..b9ffa3e --- /dev/null +++ b/Lesson4Task1/Lesson4Task1.sln @@ -0,0 +1,40 @@ + +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 +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 + 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 + {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 + EndGlobalSection +EndGlobal diff --git a/Lesson4Task1/Lesson4Task1/App.config b/Lesson4Task1/Lesson4Task1/App.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj new file mode 100644 index 0000000..0e69f40 --- /dev/null +++ b/Lesson4Task1/Lesson4Task1/Lesson4Task1.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {90A706D9-A902-4A1A-902D-A6465E512452} + Exe + Properties + Lesson4Task1 + Lesson4Task1 + v4.8 + 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..4bfa005 --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj new file mode 100644 index 0000000..d06dc4a --- /dev/null +++ b/Lesson4Task1/Lesson4Task2/Lesson4Task2.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {59E6A54D-6F6E-4D7E-97F9-C40C27960E53} + Exe + Properties + Lesson4Task2 + Lesson4Task2 + v4.8 + 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..4bfa005 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj new file mode 100644 index 0000000..1f70da0 --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/Lesson4Task3.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {17F02508-4588-4573-A18F-231847270931} + Exe + Properties + Lesson4Task3 + Lesson4Task3 + v4.8 + 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..996a1ec --- /dev/null +++ b/Lesson4Task1/Lesson4Task3/Program.cs @@ -0,0 +1,90 @@ +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 +{ + 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 < 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}"); + + } + } +} 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")] diff --git a/Lesson4Task1/Lesson4Task4/App.config b/Lesson4Task1/Lesson4Task4/App.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj new file mode 100644 index 0000000..d58915a --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/Lesson4Task4.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {0AB9ED87-1196-41FE-A505-69C49C4D5AEF} + Exe + Properties + Lesson4Task4 + Lesson4Task4 + v4.8 + 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..239f11f --- /dev/null +++ b/Lesson4Task1/Lesson4Task4/Program.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lesson4Task4 +{ + class Program + { + static int CalcFib(int n) + { + + if (n < 2) + return 1; + + int Result = CalcFib(n - 1) + CalcFib(n - 2); + // Console.Write($" {Result}, "); + return Result; + } + static void Main(string[] args) + { + Console.WriteLine("Введите положительное число для вывода Фибоначчи:"); + int input = int.Parse(Console.ReadLine()); + Console.WriteLine("Число Фибоначчи:"); + Console.Write($" {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")]