Advertisement
0_liprikon_0

Лаба 4 ООП

Apr 17th, 2022
1,325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Lab4
  4. {
  5.     class Program
  6.     {
  7.         class Tross
  8.         {
  9.             public double Form;
  10.             public Tross() { }
  11.             public static Tross operator +(Tross T, int n) //перегрузка
  12.             {
  13.                 n = 13;
  14.                 Tross prom = new Tross();
  15.                 prom.Form = T.Form + n;
  16.                 return prom;
  17.             }
  18.             public double form
  19.             {
  20.                 get { return Form; }
  21.                 set { Form = value; }
  22.             }
  23.         }
  24.  
  25.         static void Main(string[] args)
  26.         {
  27.             string[] mas = new string[3];
  28.             string line;
  29.             double F, h, L, T;
  30.             Console.WriteLine("Введите вес груза, высоту провисания троса и длину троса через пробел");
  31.             line = Console.ReadLine();
  32.             mas = line.Split();
  33.             F = double.Parse(mas[0]);
  34.             h = double.Parse(mas[1]);
  35.             L = double.Parse(mas[2]);
  36.  
  37.             T = F / (2 * Math.Sin(h / (0.5 * L)));
  38.  
  39.             Console.WriteLine("Ответ: Натяжение троса= " + T);
  40.  
  41.             Console.ReadKey();
  42.         }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement