Beispiel #1
0
 //====================================================================================
 static void Work()
 {
     try
     {
         const string AngleA = "Alpha";
         const string AngleB = "Beta";
         WriteLine($"Specify angle {AngleA} (0-360 degrees):");
         Angle         alpha = GetAngle();
         AngleOperator oper  = GetOperator();
         while (oper == "++" || oper == "--")
         {
             if (oper == "++")
             {
                 alpha++;
             }
             else
             {
                 alpha--;
             }
             WriteLine(Consts.Separator);
             WriteLine(AngleA + " = ");
             WriteLine(alpha);
             WriteLine(Consts.Separator);
             oper = GetOperator();
         }
         WriteLine($"Specify angle {AngleB} (0-360 degrees):");
         Angle beta = GetAngle();
         WriteLine(Consts.Separator);
         Write($"The result of {AngleA} {oper.Symbol} {AngleB} is: ");
         if (oper == "+")
         {
             alpha += beta;
         }
         else if (oper == "-")
         {
             alpha -= beta;
         }
         if (oper == "==")
         {
             WriteLine(alpha == beta);
         }
         else if (oper == "!=")
         {
             WriteLine(alpha != beta);
         }
         else
         {
             WriteLine("\n" + alpha);
         }
         WriteLine(Consts.Separator);
     }
     catch (Exception e)
     {
         WriteErr(e.Message);
         WriteLine("Starting over...");
         Work();
     }
 }
Beispiel #2
0
        //====================================================================================
        static AngleOperator GetOperator()
        {
            WriteLine("Specify operator (" + AngleOperator.ListOpts() + "):");
            Write(Consts.InputSymbol);
            AngleOperator oper = new AngleOperator();

            oper.ReadIn();
            return(oper);
        }