K
K
Kaytlebedeva2014-01-29 00:38:09
Pascal
Kaytlebedeva, 2014-01-29 00:38:09

How to write a Pascal program that inputs the coordinates of a point (x, y) and determines if the point falls within the shaded area?

11.png
A picture of the graph of the function is attached, only the circle and the square should be the other way around (2nd quarter-steep, 4th quarter-square).
Input: point coordinates (x, y).
Conclusion: belongs (does not belong).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Kashcheev, 2014-01-29
@Kaytlebedeva

If the boundaries are not included, then the procedure will look something like this:

procedure proc (real: x,y);
begin
    if (x < 1) and (x > 0) then
        if y > -1 and y < 0 then
            writeln('true');
        else writeln('false');
    else if sqrt(x*x + y*y) < 1 then
        if (x < 0) and (x > -1) then
            if (y > 0) and (y < -1) then
                writeln('true');
            else writeln('false');
        else writeln('false');
    else writeln('false');
end;

If there are mistakes, do not blame. I took up Pascal 2 years ago.

P
P0maxa, 2014-01-30
@P0maxa

Brad..
At least a point (0.9, -0.9)..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question