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.
|
Console.WriteLine("=== БАЗА ДАННЫХ ПОКЕМОНОВ ===");
|
||||||
fun main() {
|
Console.WriteLine($"Покемон: {pokemonName}");
|
||||||
val name = "Kotlin"
|
Console.WriteLine($"Стихия: {elementType}");
|
||||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
Console.WriteLine($"Уровень: {level} | HP: {hp}");
|
||||||
// to see how IntelliJ IDEA suggests fixing it.
|
|
||||||
println("Hello, " + name + "!")
|
// Разделительный отступ между заданиями
|
||||||
|
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
|
// ЗАДАНИЕ 2. Интерактивный ввод и паспорт
|
||||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
// ==========================================
|
||||||
println("i = $i")
|
|
||||||
|
// Последовательный запрос параметров у пользователя
|
||||||
|
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