Подскажите в чем моя ошибка - C#

Узнай цену своей работы

Формулировка задачи:

Не могу понять в чем причина. Не хочет компилироваться.
Листинг программы
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace _2_2_С_шарп
  7. {
  8. class Line
  9. {
  10. double x1, x2, y1, y2;
  11. Line()
  12. {
  13. }
  14. public Show();
  15. public Line(double _x1, double _x2, double _y1, double _y2)
  16. {
  17. x1 = _x1;
  18. x2 = _x2;
  19. y1 = _y1;
  20. y2 = _y2;
  21. }
  22. public double length()
  23. {
  24. return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  25. }
  26. }
  27. class Segment : Line
  28. {
  29. public Segment(double _x, double _x2, double _y, double _y2)
  30. {
  31. x1 = _x;
  32. x2 = _x2;
  33. y1 = _y;
  34. y2 = _y2;
  35. }
  36. public double Angle()
  37. {
  38. return atan((x1 - x2) / (y1 - y2)) * 180 / 3.14;
  39. }
  40. void Show()
  41. {
  42. Console.WriteLine(+length);
  43. }
  44. }
  45. class Program
  46. {
  47. static void main()
  48. {
  49. Segment s ;
  50. s.Show(1,1,0,1);
  51. cout << s.length()<<endl;
  52. cout << s.Angel()<<endl;
  53. cin.get();
  54. }
  55. }
  56. }

Решение задачи: «Подскажите в чем моя ошибка»

textual
Листинг программы
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2_2_С_шарп
  8. {
  9.     class Line
  10.     {
  11.        
  12.         public double x1, x2, y1, y2;
  13.         Line()
  14.         {
  15.         }
  16.         public void Show()
  17.         {
  18.             Console.WriteLine(length());
  19.         }
  20.         public Line(double _x1, double _x2, double _y1, double _y2)
  21.         {
  22.             x1 = _x1;
  23.             x2 = _x2;
  24.             y1 = _y1;
  25.             y2 = _y2;
  26.         }
  27.         public double length()
  28.         {
  29.             return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  30.         }
  31.     }
  32.  
  33.     class Segment:Line
  34.     {
  35.         public Segment (double _x, double _x2, double _y, double _y2):base(_x, _x2, _y, _y2)
  36.         {
  37.          
  38.         }
  39.         public double Angle()
  40.         {
  41.             return Math.Atan((x1 - x2) / (y1 - y2)) * 180 / 3.14;
  42.         }
  43.     }
  44.  
  45.     class Program
  46.     {
  47.  
  48.         static void Main()
  49.     {
  50.  
  51.         Segment s = new Segment(1, 1, 0, 1);
  52.         s.Show();
  53.         Console.WriteLine(s.length());
  54.         Console.WriteLine(s.Angle());
  55.         Console.ReadKey();
  56.     }
  57.     }
  58. }

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

5   голосов , оценка 3.4 из 5

Нужна аналогичная работа?

Оформи быстрый заказ и узнай стоимость

Бесплатно
Оформите заказ и авторы начнут откликаться уже через 10 минут
Похожие ответы