Festelo

C# code

Feb 13th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7.  
  8. namespace COD
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.         Body: for (;;)
  15.             {
  16.                 System.Console.Clear();
  17.                 Console.Title = "Calculation of the degrees by Festelo.";
  18.                 Console.WriteLine("Возведение в степень.\nВведите данные в консоль: *число* *степень*.\nПример: 1,2 5");
  19.                 string[] STOut = Console.ReadLine().Replace('.', ',').Split(' ');
  20.                 double[] num = { 1, 1 };
  21.                 int one = 0;
  22.                 try
  23.                 {
  24.                     for (int i = 0; i <= 1; i++)
  25.                     {
  26.                         if (!double.TryParse(STOut[one], out num[one])) break;
  27.                         one++;
  28.                     }
  29.                 }
  30.                 catch { goto Body; }
  31.                 double result = System.Math.Pow(num[0], num[1]);
  32.                 Console.WriteLine("Ответ: " + result);
  33.                 Console.ReadKey();
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment