var koor:array[1..6] of integer;
i,s:byte;
function chet(x,y:integer):byte;
begin
if (x>0) and (y>0) then chet:=1;
if (x>0) and (y<0) then chet:=2;
if (x<0) and (y<0) then chet:=3;
if (x<0) and (y>0) then chet:=4;
end;
begin
writeln('Vvedite koordinati vershini #1');
readln(koor[1],koor[2]);
writeln('Vvedite koordinati vershini #2');
readln(koor[3],koor[4]);
writeln('Vvedite koordinati vershini #3');
readln(koor[5],koor[6]);
if (chet(koor[1],koor[2])<>chet(koor[3],koor[4])) and
(chet(koor[3],koor[4])<>chet(koor[5],koor[6])) and
(chet(koor[1],koor[2])<>chet(koor[5],koor[6])) then writeln('YES, of course')
else writeln('NO, it isn"t');
readln;
end.
var koor:array[1..6] of integer;
i,s:byte;
function chet(x,y:integer):byte;
begin
if (x>0) and (y>0) then chet:=1;
if (x>0) and (y<0) then chet:=2;
if (x<0) and (y<0) then chet:=3;
if (x<0) and (y>0) then chet:=4;
end;
begin
writeln('Vvedite koordinati vershini #',1);
readln(koor[1],koor[2]);
writeln('Vvedite koordinati vershini #',2);
readln(koor[3],koor[4]);
writeln('Vvedite koordinati vershini #',3);
readln(koor[5],koor[6]);
if (chet(koor[1],koor[2])<>chet(koor[3],koor[4])) and
(chet(koor[3],koor[4])<>chet(koor[5],koor[6])) and
(chet(koor[1],koor[2])<>chet(koor[5],koor[6])) then writeln('YES, of course')
else
if (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=5)
or (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=7)
or (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=8)
or (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=10)
then writeln('YES, of course')
else writeln('NO,it isn"t...');
readln;
end.
var koor:array[1..6] of integer;
i,s:byte;
function chet(x,y:integer):byte;
begin
if (x>0) and (y>0) then chet:=1;
if (x>0) and (y<0) then chet:=2;
if (x<0) and (y<0) then chet:=3;
if (x<0) and (y>0) then chet:=4;
end;
begin
writeln('Vvedite koordinati vershini #',1);
readln(koor[1],koor[2]);
writeln('Vvedite koordinati vershini #',2);
readln(koor[3],koor[4]);
writeln('Vvedite koordinati vershini #',3);
readln(koor[5],koor[6]);
if (chet(koor[1],koor[2])<>chet(koor[3],koor[4])) and
(chet(koor[3],koor[4])<>chet(koor[5],koor[6])) and
(chet(koor[1],koor[2])<>chet(koor[5],koor[6])) then writeln('YES, of course')
else
if (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=5)
or ((chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=7)
and (chet(koor[1],koor[2])=1) or (chet(koor[3],koor[4])=1))
or (chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=8)
or ((chet(koor[1],koor[2])+chet(koor[3],koor[4])+chet(koor[5],koor[6])=10)
and (chet(koor[1],koor[2])=4) or (chet(koor[3],koor[4])=4))
then writeln('YES, of course')
else writeln('NO,it isn"t...');
readln;
end.
const
n=3; {треугольник}
r=9; {диапазон чисел}
var
t: array [1..n] of record
x,y: double;
end;
i: integer;
Inside: boolean;
u,v: double;
begin
Randomize;
for i:=1 to n do with t[i] do begin
x:=Random®*2-r;
y:=Random®*2-r;
WriteLn('x',i,'=',x:2:0,' y',i,'=',y:2:0);
end;
Inside:=true;
for i:=1 to n do begin
v:=t[i].x*t[i mod n+1].y-t[i].y*t[i mod n+1].x;
if i>1 then Inside:=Inside and (u*v>1e-15);
u:=v
end;
WriteLn(Inside)
end.
const
n=3; {треугольник}
r=9; {диапазон чисел}
var
t: array [1..n] of record
x,y: double;
end;
i: integer;
Inside: boolean;
u,v: double;
begin
Randomize;
for i:=1 to n do with t[i] do begin
x:=Random®*2-r;
y:=Random®*2-r;
WriteLn('x',i,'=',x:2:0,' y',i,'=',y:2:0);
end;
Inside:=true;
for i:=1 to n do begin
v:=t[i].x*t[i mod n+1].y-t[i].y*t[i mod n+1].x;
if i>1 then Inside:=Inside and (u*v>1e-15);
u:=v
end;
WriteLn(Inside)
end.
for i:=1 to n do with t[i] do begin
x:=Random®*2-r; { <--- }
y:=Random®*2-r; { <--- }
WriteLn('x',i,'=',x:2:0,' y',i,'=',y:2:0);
end;
for i:=1 to n do with t[i] do begin, теперь ошибки не будет. Integer вполне способен принимать отрицательные значения.
x:=Integer(Random®*2)-r; { <--- }
y:=Integer(Random®*2)-r; { <--- }
WriteLn('x',i,'=',x:2:0,' y',i,'=',y:2:0);
end;