diff --git a/lab2/image-1.png b/lab2/image-1.png new file mode 100644 index 0000000..d0a6562 Binary files /dev/null and b/lab2/image-1.png differ diff --git a/lab2/image-10.png b/lab2/image-10.png new file mode 100644 index 0000000..2d2fc46 Binary files /dev/null and b/lab2/image-10.png differ diff --git a/lab2/image-11.png b/lab2/image-11.png new file mode 100644 index 0000000..36f0ccf Binary files /dev/null and b/lab2/image-11.png differ diff --git a/lab2/image-2.png b/lab2/image-2.png new file mode 100644 index 0000000..a56800d Binary files /dev/null and b/lab2/image-2.png differ diff --git a/lab2/image-3.png b/lab2/image-3.png new file mode 100644 index 0000000..2b6875a Binary files /dev/null and b/lab2/image-3.png differ diff --git a/lab2/image-4.png b/lab2/image-4.png new file mode 100644 index 0000000..f3361be Binary files /dev/null and b/lab2/image-4.png differ diff --git a/lab2/image-5.png b/lab2/image-5.png new file mode 100644 index 0000000..dd52c6d Binary files /dev/null and b/lab2/image-5.png differ diff --git a/lab2/image-6.png b/lab2/image-6.png new file mode 100644 index 0000000..323fe5e Binary files /dev/null and b/lab2/image-6.png differ diff --git a/lab2/image-7.png b/lab2/image-7.png new file mode 100644 index 0000000..c37b1e1 Binary files /dev/null and b/lab2/image-7.png differ diff --git a/lab2/image-8.png b/lab2/image-8.png new file mode 100644 index 0000000..8851c16 Binary files /dev/null and b/lab2/image-8.png differ diff --git a/lab2/image-9.png b/lab2/image-9.png new file mode 100644 index 0000000..9fcd36e Binary files /dev/null and b/lab2/image-9.png differ diff --git a/lab2/image.png b/lab2/image.png new file mode 100644 index 0000000..b4ffecc Binary files /dev/null and b/lab2/image.png differ diff --git a/lab2/lab2.md b/lab2/lab2.md new file mode 100644 index 0000000..47e3969 --- /dev/null +++ b/lab2/lab2.md @@ -0,0 +1,152 @@ +# ЛАБОРАТОРНАЯ РАБОТА №2 + +## БЛОК 1 + +### Задание №1 + +``` + static void Main(string[] args) + { + Console.WriteLine("=== ПРОКАЧКА ПОКЕМОНА ==="); //вывод + Console.Write("Введите базовое значение атаки покемона: "); //вывод, но запрашвает у пользователя + int baseAttack = Convert.ToInt32(Console.ReadLine()); //можно и так Convert - аналог Parse //вывод + Console.Write("Введите кол-во уровней: "); + int level = Convert.ToInt32(Console.ReadLine()); + + int finalAttack = baseAttack + (level * 5); //формула итоговой атаки = базовая_атака + (уровень * 5) + + Console.Clear(); //Очистка консоля, сначало запрашивает у пользователя, потом очищает консоль и выводит следующий итог + + Console.WriteLine($@"=== ПРОКАЧКА ПОКЕМОНА === +Базовое значение атаки покемона: {baseAttack} +Кол-во полученных уровней: {level}"); //вывод + + Thread.Sleep(1000); //таймер 1 сек + + Console.WriteLine("\nФормула итоговой атаки = базовая атака + (уровень * 5)"); + Console.WriteLine($"Итоговая атака равна {finalAttack}"); //вывод итоговой атаки + + } +``` + +###### ВЫВОД: + +![alt text](image.png) + +### Задане №2 + +``` + static void Main(string[] args) + { + int balance = 1500; //всего на балансе + int potion = 200; //1 зелье стоит 200 монеты + + Console.WriteLine("=== ПРОФИЛЬ ==="); + Console.WriteLine($@"Начальный баланс тренера: {balance} +Стоимость одного Зелья Лечения(Potion): {potion}"); + + Console.Write("Сколько понадобится зелье, чтобы купить: "); //вывод + int buy = Convert.ToInt32(Console.ReadLine()); //запрашивает кол-во у пользователя + int total = buy * potion; //всего итоговая оплата зелья + if (balance >= total) //проверка условие + { + balance -= total; //баланс снимает итоговой оплаты зелья + Console.WriteLine($"Стоимость {buy} зелье за {total}"); + Console.WriteLine("Успешная оплата!"); + Console.WriteLine($"Остаток на балансе: {balance}"); + } + else + { + Console.WriteLine("Недостаточно средств!"); //не хватает монеты, если покупают больше 8 зелье + } + } +``` + +###### ВЫВОД: + +Если хватает, то: + +![alt text](image-1.png) + +Если не хватает, то: + +![alt text](image-2.png) + + +## БЛОК 2 + +### Задание № 2.1 + +``` + +``` + +###### ВЫВОД: + +при hp >= 50 + +![alt text](image-3.png) + +при hp <= 49 & hp >= 21 + +![alt text](image-4.png) + +при hp <= 20 & hp >= 1 + +![alt text](image-5.png) + +при hp <= 0 + +![alt text](image-6.png) + +### Задание № 2.2 + +``` + static void Main(string[] args) + { + Console.WriteLine("Меню: 1 - Атака, 2 - Инвентарь, 3 - Сменить покемона, 4 - Побег"); //вывод + Console.Write("Выберите меню: "); + int menu = Convert.ToInt32(Console.ReadLine()); //запрашивает у пользователя + + switch (menu) + { + case 1: + Console.WriteLine("Покемон наносит быстрый удар!"); //1 клавиша + break; //конец и возвращает значение + case 2: + Console.WriteLine("Вы открыли сумку и применили Зелье Лечения."); //2 клавиша + break; + case 3: + Console.WriteLine("Вы отозвали покемона и выпустили нового!"); //3 клавиша + break; + case 4: + Console.WriteLine("Вы успешно сбежали из боя!"); //4 клавиша + break; + default: + Console.WriteLine("Неизвестная команда! Вы пропустили ход."); // неизвестная команда, если нажать любая клавиша кроме 1,2,3 и 4 + break; + } + } +``` + +###### ВЫВОД: + +Атака (при нажатии 1) + +![alt text](image-7.png) + +Инвентарь (при нажатии 2) + +![alt text](image-8.png) + +Сменить покемона (при нажатии 3) + +![alt text](image-9.png) + +Побег (при нажатии 4) + +![alt text](image-10.png) + +При нажатии любой клавиши, кроме 1-4, тогда появится неизвестная команда + +![alt text](image-11.png) \ No newline at end of file