1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| Program Calcul;
uses math, unite;
Procedure Saisie (var coord1, coord2 : Coordonnees);
var entree, sortie1,sortie2 : text;
latitude, longitude: String; ville: String;
var pa,pd : string;
begin
writeln ('Point de depart');
readln(pd);
writeln ('Point arrivee');
readln(pa);
assign(entree,'destination.txt');
reset(entree);
assign(sortie1,'depart.txt');
rewrite(sortie1);
assign (sortie2, 'arrivee.txt');
rewrite(sortie2);
while not(eof(entree)) do
begin
readln(entree, latitude);
readln(entree, longitude);
readln(entree, ville);
begin
if ville = pa then
begin
writeln (sortie1, latitude);
writeln (sortie1, longitude);
end;
end;
begin
if ville = pd then
begin
writeln(sortie2, latitude);
writeln (sortie2, longitude);
end;
close(sortie1);
close(sortie2);
close(entree);
end;
begin
reset(sortie1);
read(sortie1);
writeln (coord1.longitude);
readln(coord1.longitude);
writeln (coord1.latitude);
readln(coord1.latitude);
close(sortie1);
end;
begin
reset(sortie2);
read(sortie2);
readln(coord2.longitude);
readln (coord2.latitude);
close (sortie2);
end;
close(entree);
end;
readln(coord1.longitude);
close(sortie1);
begin
reset(sortie2);
read(sortie2);
readln(coord2.latitude);
readln (coord2.longitude);
close (sortie2);
end;
close(entree);
end;
Function Calculcurviligne (coord1,coord2: Coordonnees) : Real;
var
S, delta, resultat: Real;
Begin
delta := (Coord2.Longitude-Coord1.Longitude);
S := arccos (sin(Coord1.latitude)*sin(Coord2.latitude) + cos(Coord1.latitude)*cos(Coord2.latitude)*cos(delta) );
resultat := 6378*S;
Calculcurviligne := resultat;
writeln ('Distance a parcourir', resultat, 'en kms')
end;
Procedure Affichage (coord1, coord2 : Coordonnees; var distance : Real);
Begin
distance:=Calculcurviligne(coord1,coord2);
write ('Distance a parcourir ');
writeln (distance);
end;
var distance : Real;
var coord1,coord2 : Coordonnees;
begin
Saisie (coord1, coord2);
Affichage(coord1, coord2, distance);
end.
end. |
Partager