Beispiel #1
0
        public void Del(Class_str s)
        {
            bool k = true;
            int  i;

            for (i = 0; i < text.Length; i++)
            {
                k = true;
                for (int j = 0; j < text[i].getSize(); j++)
                {
                    if (s.getChar(j) != text[i].getChar(j))
                    {
                        k = false;
                    }
                }
                if (k)
                {
                    break;
                }
            }
            if (k == false)
            {
                return;
            }

            for (long z = i; z < text.Length - 1; ++z)
            {
                text[z] = text[z + 1];
            }
            Array.Resize(ref text, text.Length - 1);
        }
Beispiel #2
0
        public int HowMany(Class_str s)
        {
            int c = 0;

            for (int i = 0; i < text.Length; i++)
            {
                int k = 1;
                for (int j = 0; j < text[i].getSize(); j++)
                {
                    if (s.getChar(j) != text[i].getChar(j))
                    {
                        k = 0;
                    }
                }
                c += k;
            }
            return(c);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Class_str h = new Class_str(new char[] { 'h', 'e', 'l', 'l', 'o', ' ' });

            Class_str  w = new Class_str(new char[] { 'w', 'o', 'r', 'l', 'd', '3' });
            Class_text t = new Class_text(new Class_str[] { h });

            t.Add(w);
            t.Del(h);
            int xd = t.Elements();

            Console.WriteLine(xd);
            t.Clear();
            t.Add(h);
            t.Add(h);
            t.Add(w);
            Console.WriteLine(t.HowMany(h));
        }
Beispiel #4
0
 public void Add(Class_str a)
 {
     Array.Resize(ref text, text.Length + 1);
     text[text.Length - 1] = a;
 }