Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.29 KB | None | 0 0
  1.   program lab1;
  2.   uses crt;
  3.   var
  4.    ch: char;
  5.    R, Oo: real;
  6.    Ct, A: real;
  7.    P,T: boolean;
  8.   function max_r(a,b:Real):Real;
  9.   begin
  10.    if (a>b) then max_r:=a else max_r:=b;
  11.   end;
  12.   function WrongInput(condition:boolean):boolean;
  13.   begin
  14.    if condition then
  15.    begin
  16.     WriteLn('Wrong input!');
  17.     WrongInput:=false;
  18.    end else WrongInput:=true;
  19.   end;
  20.   begin
  21.    repeat
  22.     clrscr;
  23.     repeat
  24.      writeln('Type radius and center of circle');
  25.      readln(R,Oo);
  26.     until WrongInput((R<0) or (Oo<0));
  27.     repeat
  28.      writeln('Type center of base and lenght of side of triangle');
  29.      readln(Ct,A);
  30.     until WrongInput((Ct<0) or (A<0));
  31.     P:=abs(Oo-Ct)<(R+A/2);
  32.     T:=abs(Oo-Ct)=(R+A/2);
  33.     if P then
  34.      begin
  35.       if (Oo=Ct) then WriteLn('Concentric') else WriteLn('Non Concentric');
  36.       if ((sqrt(sqr(Ct-Oo)+sqr(a*sqrt(3)/2))<=R) or (max_r(Ct+A/2-Oo,Oo-Ct+A/2)<=R)) then WriteLn('Triangle in half-circle')
  37.       else
  38.        if (A/2-abs(Oo-Ct))*sqrt(3)/2>=R then Writeln('Half-Circle in triangle')
  39.        else WriteLn('Crossing');
  40.      end
  41.     else
  42.      begin
  43.       if T then writeln('Touching') else writeln('Not crossing');
  44.      end;
  45.     writeln('Press N/n to exit any other key to restart program');
  46.     ch:=Readkey
  47.    until (ch='N') or (ch='n')
  48.   end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement