Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Data_class cur = new Data_class(0);

            while (true)
            {
                Console.WriteLine("");
                Console.WriteLine("Enter Commands");
                string[] words = Console.ReadLine().Split(new Char[] { ' ' });

                if (words[0] == "create")
                {
                    cur = CreateDataClass();
                }
                else if (words[0] == "cmp")
                {
                    Cmp(cur, Convert.ToInt32(words[1]), Convert.ToString(words[2]));
                }
                else if (words[0] == "avg")
                {
                    Console.WriteLine("Average parameter value:" + cur.Avg_par());
                }
                else if (words[1] == "print")
                {
                    cur.Print();
                }
            }
        }
Example #2
0
 static void Cmp(Data_class cur, int index, int jndex)
 {
     if (cur[index] < cur[jndex])
     {
         Console.WriteLine(index + "(" + cur[index] + ")" + "<" + jndex + "(" + cur[jndex] + ")");
     }
     else
     {
         Console.WriteLine(index + "(" + cur[index] + ")" + ">" + jndex + "(" + cur[jndex] + ")");
     }
 }