Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication9
- {
- class MyMathOper
- {
- public double r;
- public string s;
- public double sqrCircle()
- {
- return Math.PI * (r * r);
- }
- public double longCircle()
- {
- return 2 * Math.PI * r;
- }
- public void WriteResult()
- {
- Console.Write("Вычислить S или L? ");
- s = Console.ReadLine();
- s = s.ToLower();
- if (s == "s")
- {
- Console.WriteLine("S круга = " + sqrCircle());
- return;
- }
- else if (s == "l")
- {
- Console.WriteLine("L круга = " + longCircle());
- return;
- }
- else
- Console.WriteLine("Неверно");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите радиус: ");
- string rad = Console.ReadLine();
- MyMathOper newOper = new MyMathOper { r = double.Parse(rad)};
- newOper.WriteResult();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement