add lab03 c#
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// task 1
|
||||
/*
|
||||
string pokemon1Name = "Пикачу";
|
||||
int pokemon1Hp = 50;
|
||||
int pokemon1Attack = 12;
|
||||
string pokemon2Name = "Булбазавр";
|
||||
int pokemon2Hp = 55;
|
||||
int pokemon2Attack = 10;
|
||||
int roundNumber = 1;
|
||||
|
||||
Console.WriteLine("Приготовьтесь!");
|
||||
for (int i = 3 ; i >= roundNumber ; i--)
|
||||
{
|
||||
Console.WriteLine(i + "...");
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ===");
|
||||
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
|
||||
*/
|
||||
|
||||
// task 2
|
||||
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
int choice;
|
||||
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
|
||||
|
||||
do
|
||||
{
|
||||
choice = int.Parse(Console.ReadLine());
|
||||
if (choice == 1)
|
||||
{
|
||||
Console.WriteLine("Вы начали бой!");
|
||||
}
|
||||
|
||||
else if (choice == 0)
|
||||
{
|
||||
Console.WriteLine("Вы отменили бой!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Некорректная команда! Попробуйте снова.");
|
||||
}
|
||||
} while (choice != 1 && choice != 0);
|
||||
Reference in New Issue
Block a user