using System.Collections.Generic;
public Card(string current, string next) { this.current = current; this.next = next; }
static public List<Card> cards;
static public void Main(string[] args)
static void CreateCards(ref List<Card> cards)
cards = new List<Card>();
cards.Add(new Card("Мельбурн", "Кельн"));
cards.Add(new Card("Москва", "Париж"));
cards.Add(new Card("Кельн", "Москва"));
cards.Add(new Card("Аделаида", "Мельбурн"));
static void OrderCards(List<Card> cards)
Card tempCard; bool changed; bool changedL2;
for (int i = 0; i < cards.Count; i++)
for (int i2 = 0; i2 < cards.Count; i2++)
if (cards[i].next == cards[i2].current)
{ tempCard = cards[i + 1]; cards[i + 1] = cards[i2]; cards[i2] = tempCard; changedL2 = true; }
if (cards[i].next == cards[i2].current)
{ SwapAll(cards); changedL2 = true; }
static void SwapAll(List<Card> cards)
for (int i = cards.Count-1; i > 0; i--)
tempCard = cards[i - 1]; cards[i - 1] = cards[i]; cards[i] = tempCard;
static void WriteAll(List<Card> cards)
for (int i = 0; i < cards.Count; i++)
Console.WriteLine("Текущий город: " + cards[i].current + ", следующий город: " + cards[i].next);