Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace ooo
- {
- class MainClass
- {
- public static void choose(uint r)
- {
- Console.Write ("Введите номер операции: ");
- uint x = Convert.ToUInt32 (Console.ReadLine ());
- switch (x)
- {
- case 1:
- Console.WriteLine ("S треугольника со стороной {0} равна {1:f3}", r, trgle (r));
- break;
- case 2:
- Console.WriteLine ("S квадрата со стороной {0} равна {1}", r, sqr (r));
- break;
- case 3:
- Console.WriteLine ("S окружности со стороной {0} равна {1:f3}", r, circ (r));
- break;
- }
- if (x!=1 && x!=2 && x!=3)
- {
- Console.WriteLine ("Ошибка");
- choose (r);
- }
- return;
- }
- private static double trgle(uint j)
- {
- double S = Math.Sqrt(3)*j*j/4;
- return S;
- }
- private static double circ(uint j)
- {
- double S = Math.PI * j * j;
- return S;
- }
- private static uint sqr(uint j)
- {
- uint S = j * j;
- return S;
- }
- public static void Main (string[] args)
- {
- Console.Write (" 1 - для треугольника \n 2 - для квадрата \n 3 - для окружности \n Введите количество фигур: ");
- uint Q = Convert.ToUInt32 (Console.ReadLine());
- for (int i = 0; i < Q; i++)
- {
- Console.Write ("r = ");
- uint r = Convert.ToUInt32 (Console.ReadLine ());
- choose (r);
- }
- Console.ReadKey ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement