using System;
using System.Collections.Generic;
class Program
{
static List<string> persons = new List<string>();
static void Main(string[] args)
{
bool exit = false;
while (!exit)
{
Console.WriteLine("Menu:");
Console.WriteLine("1. Dodawanie nowej osoby");
Console.WriteLine("2. Usuwanie osoby");
Console.WriteLine("3. Wyświetlanie wszystkich osób");
Console.WriteLine("4. Wyświetlanie pojedynczej osoby");
Console.WriteLine("5. Wyjście");
Console.WriteLine("Wybierz opcję:");
string choice = Console.ReadLine();
switch (choice)
{
case "1":
Console.WriteLine("Podaj imię osoby do dodania:");
string name = Console.ReadLine();
persons.Add(name);
Console.WriteLine("Osoba dodana pomyślnie.");
break;
case "2":
Console.WriteLine("Podaj indeks osoby do usunięcia:");
if (int.TryParse(Console.ReadLine(), out int index) && index >= 0 && index < persons.Count)
{
persons.RemoveAt(index);
Console.WriteLine("Osoba usunięta pomyślnie.");
}
else
{
Console.WriteLine("Niepoprawny indeks.");
}
break;
case "3":
Console.WriteLine("Lista osób:");
foreach (string person in persons)
{
Console.WriteLine(person);
}
break;
case "4":
Console.WriteLine("Podaj indeks osoby do wyświetlenia:");
if (int.TryParse(Console.ReadLine(), out int displayIndex) && displayIndex >= 0 && displayIndex < persons.Count)
{
Console.WriteLine($"Osoba na pozycji {displayIndex}: {persons[displayIndex]}");
}
else
{
Console.WriteLine("Niepoprawny indeks.");
}
break;
case "5":
exit = true;
Console.WriteLine("Wyjście...");
break;
default:
Console.WriteLine("Niepoprawna opcja. Wybierz ponownie.");
break;
}
Console.WriteLine("Naciśnij dowolny klawisz, aby kontynuować...");
Console.ReadKey();
Console.Clear(); // Opcjonalnie, aby czytelniej wyglądało menu po kolejnych wyborach.
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}