generated from admin/template
88 lines
4.0 KiB
Markdown
88 lines
4.0 KiB
Markdown
# Тема: Введение в язык C#. Переменные, базовые типы данных и консольный ввод/вывод информации
|
|
|
|
## Ключевой код
|
|
```csharp
|
|
// Задание 1. Объявление переменных и статический вывод данных
|
|
using System;
|
|
|
|
class Program {
|
|
static void Main() {
|
|
string pokemonName ="Charmander";
|
|
string elementType = "Fire";
|
|
int level = 1;
|
|
int hp = 95;
|
|
Console.WriteLine($"===Database== \n Pokemon: {pokemonName} \n Element: {elementType} \n Level: {level}| HP: {hp}");
|
|
|
|
}
|
|
}
|
|
|
|
//Задание 2. Интерактивный ввод и динамическое формирование документов
|
|
using System;
|
|
|
|
public class Test
|
|
{
|
|
public static void Main()
|
|
{
|
|
Console.Write("Введите имя тренера: ");
|
|
string trainerName = Console.ReadLine() ;
|
|
Console.Write("Введите имя покемона: ");
|
|
string pokemonName = Console.ReadLine();
|
|
Console.Write("Введите стихию: ");
|
|
string elementType = Console.ReadLine();
|
|
Console.Write("Введите регион: ");
|
|
string regionName = Console.ReadLine();
|
|
Console.WriteLine("");
|
|
Console.WriteLine($"****************************************\n " +
|
|
$"ПАСПОРТ ПОКЕМОНА \n Тренер: {trainerName} (Регион: {regionName})\n " +
|
|
$"Покемон: {pokemonName} [ Стихия: {elementType}] \n" +
|
|
$"**************************************** ");
|
|
|
|
}
|
|
}
|
|
|
|
//Техническое задание: Оцифровка карточки Pokémon TCG
|
|
namespace stage1;
|
|
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Console.Write("стадия развития: ");
|
|
string stage = Console.ReadLine();
|
|
Console.Write("имя покемона: ");
|
|
string name = Console.ReadLine();
|
|
Console.Write("вид покемона: ");
|
|
string category = Console.ReadLine();
|
|
Console.Write("название первой атаки: ");
|
|
string attack1Name = Console.ReadLine();
|
|
Console.Write("эффект первой атаки: ");
|
|
string attack1Desc = Console.ReadLine();
|
|
Console.Write("название второй атаки: ");
|
|
string attack2Name = Console.ReadLine();
|
|
Console.Write("эффект второй атаки: ");
|
|
string attack2Desc = Console.ReadLine();
|
|
Console.Write("уязвимость: ");
|
|
string weakness = Console.ReadLine();
|
|
Console.Write("устойчивость: ");
|
|
string resistance = Console.ReadLine();
|
|
|
|
int hp = 60;
|
|
int number = 25;
|
|
double height = 0.4;
|
|
double weight = 6.0;
|
|
int attack2Damage = 20;
|
|
int retreatCost = 1;
|
|
|
|
Console.Clear();
|
|
Console.WriteLine($"====================================================================== \n [{stage}] {name,-42} ОЖ: {hp} [⚡] \n " +
|
|
$"---------------------------------------------------------------------- \n" +
|
|
$" № {number} | Вид: {category} | Рост: {height} м | Вес: {weight} кг \n" +
|
|
$"---------------------------------------------------------------------- \n " +
|
|
$"[Атака 1] {attack1Name} \n Эффект: {attack1Desc} \n \n" +
|
|
$"[Атака 2] {attack2Name,-42} Урон: {attack2Damage} \n Эффект: {attack2Desc} \n " +
|
|
$"---------------------------------------------------------------------- \n" +
|
|
$"Слабость: {weakness} \n Устойчивость: {resistance} \n Отступление: {retreatCost} \n" +
|
|
$"======================================================================");
|
|
}
|
|
}
|