// PascalABC.NET 3.1, сборка 1230 от 27.04.2016 type Point=record x,y:real end;
function ReadPoint(c:char):Point; begin Write('Координаты точки ',c,': '); Read(Result.x,Result.y); end;
procedure Quarter(a:Point); begin Write('Точка (',a.x,',',a.y,') '); if a.x<0 then begin if a.y>0 then Writeln('принадлежит II четверти') else if a.y=0 then Writeln('лежит на оси абсцисс') else Writeln('принадлежит III четверти') end else if a.x=0 then begin if a.y=0 then Writeln('лежит на пересечении координатных осей') else Writeln('лежит на оси ординат') end else if a.y<0 then Writeln('принадлежит IV четверти') else begin if a.y=0 then Writeln('лежит на оси абсцисс') else Writeln('принадлежит I четверти') end end;
begin var a,b:Point; a:=ReadPoint('A'); b:=ReadPoint('B'); Quarter(a); Quarter(b); Write('Расстояние от точки А до начала координат: '); Writeln(sqrt(sqr(a.x)+sqr(b.x))) end.
Тестовое решение: Координаты точки A: -3.7 1.73 Координаты точки B: 6 8 Точка (-3.7,1.73) принадлежит II четверти Точка (6,8) принадлежит I четверти Расстояние от точки А до начала координат: 7.04911341943084
//Как давно я не писал program //Pascal ABC.NET v3.1 сборка 1219
program boshe10iz10; Var xa,ya,xb,yb:real;
function qua(x,y:real):byte; begin if (x>0) and (y>0) then qua:=1; if (x<0) and (y>0) then qua:=2; if (x<0) and (y<0) then qua:=3; if (x>0) and (y<0) then qua:=4; end;
function dist(x,y:real):real; begin dist:=sqrt(sqr(x)+sqr(y)); end;
begin read(xa,ya,xb,yb); writeln('Point A in ',qua(xa,ya),' quarter'); writeln('Point B in ',qua(xb,yb),' quarter'); writeln('The distance from the origin to the point A=',dist(xa,ya)); end.
Пример ввода: 2.75 -7.25 3 4 Пример вывода: Point A in 4 quarter Point B in 1 quarter The distance from the origin to the point A=7.75403120963541
Во вложении
Объяснение: