generated from admin/template
Обновить works/c#/lab1/Readme.md
This commit is contained in:
+44
-12
@@ -1,17 +1,49 @@
|
||||
# Задание номер один
|
||||
# отчет
|
||||
|
||||
# ЗАДАНИЕ 1. Статический вывод данных
|
||||
|
||||
# Объявление и инициализация переменных
|
||||
string pokemonName = "Чармандер";
|
||||
string elementType = "Огонь";
|
||||
int level = 1;
|
||||
int hp = 95;
|
||||
|
||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
fun main() {
|
||||
val name = "Kotlin"
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||
// to see how IntelliJ IDEA suggests fixing it.
|
||||
println("Hello, " + name + "!")
|
||||
* Форматированный вывод в консоль с помощью интерполяции строк
|
||||
Console.WriteLine("=== БАЗА ДАННЫХ ПОКЕМОНОВ ===");
|
||||
Console.WriteLine($"Покемон: {pokemonName}");
|
||||
Console.WriteLine($"Стихия: {elementType}");
|
||||
Console.WriteLine($"Уровень: {level} | HP: {hp}");
|
||||
|
||||
// Разделительный отступ между заданиями
|
||||
Console.WriteLine();
|
||||
|
||||
for (i in 1..5) {
|
||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||
println("i = $i")
|
||||
// ==========================================
|
||||
// ЗАДАНИЕ 2. Интерактивный ввод и паспорт
|
||||
// ==========================================
|
||||
|
||||
// Последовательный запрос параметров у пользователя
|
||||
Console.Write("Введите имя тренера: ");
|
||||
string trainerName = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите имя покемона: ");
|
||||
pokemonName = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите стихию: ");
|
||||
elementType = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите регион: ");
|
||||
string regionName = Console.ReadLine();
|
||||
|
||||
// Вывод итогового паспорта объекта
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("****************************************");
|
||||
Console.WriteLine("ПАСПОРТ ПОКЕМОНА");
|
||||
Console.WriteLine($"Тренер: {trainerName} (Регион: {regionName})");
|
||||
Console.WriteLine($"Покемон: {pokemonName} [Стихия: {elementType}]");
|
||||
Console.WriteLine("****************************************");
|
||||
|
||||
// Ожидание нажатия клавиши перед закрытием консоли
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user