コード例 #1
0
ファイル: Backpack.cs プロジェクト: sankaugil/WeaponShop
        public void printList()
        {
            BackpackNode curr = head;

            while (curr != null)
            {
                Console.Write(" {0} ", curr.data.weaponName);
                curr = curr.next;
            }
            Console.WriteLine();
        }
コード例 #2
0
ファイル: Backpack.cs プロジェクト: sankaugil/WeaponShop
        public void addLast(Weapon b)
        {
            BackpackNode newNode = new BackpackNode(b);

            if (head == null)
            {
                head = newNode;
                return;
            }
            BackpackNode curr = head;

            while (curr.next != null)
            {
                curr = curr.next;
            }
            curr.next = newNode;
        }
コード例 #3
0
 public BackpackNode(Weapon b)
 {
     data = b;
     next = null;
 }
コード例 #4
0
ファイル: Backpack.cs プロジェクト: sankaugil/WeaponShop
 public Backpack(double m)
 {
     head          = null;
     maxWeight     = m;
     presentWeight = 0;
 }