Widzicie, że dziewczyna nie miała styczności z Pascalem i mówicie jej zamiast pomóc.
program Trojkaty;
var
m : integer;
a, b, c, p, h, ax, ay, bx, by, cx, cy : real;
begin
Writeln( 'Metody: ' );
Writeln( ' 1 - podstawowa ' );
Writeln( ' 2 - Herona ' );
Writeln( ' 3 - wektorowa ' );
Writeln( 'Podaj numer metody ( 1-3 ): ' );
Read( m );
if m = 1 then
begin
Writeln( 'Podaj wysokosc: ' );
Read( h );
Writeln( 'Podaj dlugosc podstawy: ' );
Read( a );
Writeln( 'Pole tego trojkata wynosi: ' );
Write( a * h / 2 );
Readln();
end
else if m = 2 then
begin
Writeln( 'Podaj bok A: ' );
Read( a );
Writeln( 'Podaj bok B: ' );
Read( b );
Writeln( 'Podaj bok C: ' );
Read( c );
p := ( a + b + c ) / 2;
Writeln( 'Pole tego trojkata wynosi: ' );
Write( sqrt( p * ( p - a ) * ( p - b ) * ( p - c ) ) );
Readln();
end
else if m = 3 then
begin
Writeln( 'Podaj puntk Ax: ' );
Read( ax );
Writeln( 'Podaj puntk Ay: ' );
Read( ay );
Writeln( 'Podaj puntk Bx: ' );
Read( bx );
Writeln( 'Podaj puntk By: ' );
Read( by );
Writeln( 'Podaj puntk Cx: ' );
Read( cx );
Writeln( 'Podaj puntk Cy: ' );
Read( cy );
Writeln( 'Pole tego trojkata wynosi: ' );
Write( abs( ax * by + bx * cy + cx * ay - cx * by - ax * cy - bx * ay ) / 2 );
Readln();
end
else
Writeln( 'Musisz podac od 1 do 3' );
Readln();
end.
Dałem readln w paru miejscach i myślę, że będzie działać. Nie programuje w Pascalu, więc nie jestem co do tego przekonany na 100%.