All pastes #457571 Raw Edit

Miscellany

public text v1 · immutable
#457571 ·published 2007-04-25 13:57 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace test2
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();
            list.Add("soren");
            list.Add("yani");
            list.Add("prasavi");
            list.Add("anne");
            list.Add("sarojini");
            Console.Write("enter a name from list :  ");
            string[] names = Console.ReadLine().Split(new char[] { ' ' });
            



            if (HasAllElements(list, names))
            {
                Console.WriteLine("You guessed all names!");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("You missed some names");
                Console.ReadLine();

            }

        }

         public static bool HasAllElements(ArrayList list, string[] elements)
        {
            for (int i = 0; i < list.Count; i++)
            {
                if (!list.Contains(list[i]))
                {
                    return false;
                }

                }
                return true;
            
            } 
       
            } 
}