Подскажите в чем моя ошибка - C#
Формулировка задачи:
Не могу понять в чем причина.
Не хочет компилироваться.
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _2_2_С_шарп
- {
- class Line
- {
- double x1, x2, y1, y2;
- Line()
- {
- }
- public Show();
- public Line(double _x1, double _x2, double _y1, double _y2)
- {
- x1 = _x1;
- x2 = _x2;
- y1 = _y1;
- y2 = _y2;
- }
- public double length()
- {
- return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- }
- class Segment : Line
- {
- public Segment(double _x, double _x2, double _y, double _y2)
- {
- x1 = _x;
- x2 = _x2;
- y1 = _y;
- y2 = _y2;
- }
- public double Angle()
- {
- return atan((x1 - x2) / (y1 - y2)) * 180 / 3.14;
- }
- void Show()
- {
- Console.WriteLine(+length);
- }
- }
- class Program
- {
- static void main()
- {
- Segment s ;
- s.Show(1,1,0,1);
- cout << s.length()<<endl;
- cout << s.Angel()<<endl;
- cin.get();
- }
- }
- }
Решение задачи: «Подскажите в чем моя ошибка»
textual
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _2_2_С_шарп
- {
- class Line
- {
- public double x1, x2, y1, y2;
- Line()
- {
- }
- public void Show()
- {
- Console.WriteLine(length());
- }
- public Line(double _x1, double _x2, double _y1, double _y2)
- {
- x1 = _x1;
- x2 = _x2;
- y1 = _y1;
- y2 = _y2;
- }
- public double length()
- {
- return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- }
- class Segment:Line
- {
- public Segment (double _x, double _x2, double _y, double _y2):base(_x, _x2, _y, _y2)
- {
- }
- public double Angle()
- {
- return Math.Atan((x1 - x2) / (y1 - y2)) * 180 / 3.14;
- }
- }
- class Program
- {
- static void Main()
- {
- Segment s = new Segment(1, 1, 0, 1);
- s.Show();
- Console.WriteLine(s.length());
- Console.WriteLine(s.Angle());
- Console.ReadKey();
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д