Ejemplo n.º 1
0
 public void AddToEnd(contactInfo data)
 {
     if (headNode == null)
     {
         headNode = new Node(data);
     }
     else
     {
         headNode.AddToEnd(data);
     }
 }
Ejemplo n.º 2
0
 public void AddToEnd(contactInfo data)
 {
     if (next == null)
     {
         next = new Node(data);
     }
     else
     {
         next.AddToEnd(data);
     }
 }
Ejemplo n.º 3
0
        public static void askForContactInfo(MyList list)
        {
            ConsoleKeyInfo quitSentinel;

            do
            {
                // Get user input for contact information.
                Console.WriteLine("==========================");
                Console.WriteLine("Please enter your contact information!\n");

                Console.Write("Enter your first name: ");
                String firstName = Console.ReadLine();

                Console.Write("Enter your last name: ");
                String lastName = Console.ReadLine();

                Console.Write("Enter your address: ");
                String address = Console.ReadLine();

                Console.Write("Enter your city: ");
                String city = Console.ReadLine();

                Console.Write("Enter your state: ");
                String state = Console.ReadLine();

                // Populate contactInfo data structure.
                contactInfo contacts = new contactInfo(firstName, lastName, address, city, state);

                // Add newly instantiated data structure to the back of the linked list.
                list.AddToEnd(contacts);

                Console.WriteLine("\nIf you would like to stop entering contact information, press the Escape button." +
                                  "\nOtherwise, press any button to continue.");
                quitSentinel = Console.ReadKey();
            } while (quitSentinel.Key != ConsoleKey.Escape);
            Console.WriteLine("\n");
        }
Ejemplo n.º 4
0
 public Node(contactInfo i)
 {
     data = i;
     next = null;
 }