Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program lab1;
- uses crt;
- var
- ch: char;
- R, Oo: real;
- Ct, A: real;
- P,T: boolean;
- function max_r(a,b:Real):Real;
- begin
- if (a>b) then max_r:=a else max_r:=b;
- end;
- function WrongInput(condition:boolean):boolean;
- begin
- if condition then
- begin
- WriteLn('Wrong input!');
- WrongInput:=false;
- end else WrongInput:=true;
- end;
- begin
- repeat
- clrscr;
- repeat
- writeln('Type radius and center of circle');
- readln(R,Oo);
- until WrongInput((R<0) or (Oo<0));
- repeat
- writeln('Type center of base and lenght of side of triangle');
- readln(Ct,A);
- until WrongInput((Ct<0) or (A<0));
- P:=abs(Oo-Ct)<(R+A/2);
- T:=abs(Oo-Ct)=(R+A/2);
- if P then
- begin
- if (Oo=Ct) then WriteLn('Concentric') else WriteLn('Non Concentric');
- 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')
- else
- if (A/2-abs(Oo-Ct))*sqrt(3)/2>=R then Writeln('Half-Circle in triangle')
- else WriteLn('Crossing');
- end
- else
- begin
- if T then writeln('Touching') else writeln('Not crossing');
- end;
- writeln('Press N/n to exit any other key to restart program');
- ch:=Readkey
- until (ch='N') or (ch='n')
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement