2 COMMENT SECOND EXAMPLE PROGRAM FROM BALGOL MANUAL, MARCH 1963.
2 THIS IS THE CORRECTED VERSION THAT COMPUTES AREA USING NORTH/SOUTH
2 RATHER THAN NORTH/SOUTH DISPLACEMENTS IN THE CALCULATION FOR -SUM-.
2
2 THE PROGRAM WHICH FOLLOWS IS ONE FOR SURVEY TRAVERSE CALCULATIONS;
2
2 COMMENT SURVEY TRAVERSE CALCULATIONS;
2 TRACE ANGLE;
2 DUMP EW, NS, CD;                                                              *WAS DUMP EW, NSC, CD;*
2 INTEGER I, J, K, SURVEY, D(), M(), S(), Q(), N;
2 FUNCTION LENGTH(X,Y) = SQRT(X*2 + Y*2);
2 ARRAY D(200), M(200), S(200), Q(200), MD(200), NS(200),
2       EW(200), CNS(201), CEW(201);
2
2 START..
2   READ(;; IDENT);
2   TMD = 0; TNS = 0; TEW = 0;
2   FOR I= (1,1,N);
2     BEGIN
2     READ (;; STATION);
2     IF I NEQ K;
2       STOP K;
2
2     Z = (60(60D(I) + M(I)) + S(I))/6.48**5;
2     SWITCH Q(I), (QUAD1, QUAD2, QUAD3, QUAD4);
2     QUAD1.. Z = 0.5 - Z; GO TO ANGLE;
2     QUAD2.. Z = 1.5 + Z; GO TO ANGLE;
2     QUAD3.. Z = 0.5 + Z; GO TO ANGLE;
2     QUAD4.. Z = 1.5 - Z;
2 ANGLE..
2     ALPHA = 3.1415927Z;
2     NS(I) = MD(I)SIN(ALPHA);
2     TNS = TNS + NS(I);
2     EW(I) = MD(I)COS(ALPHA);
2     TEW = TEW + EW(I);
2     TMD = TMD + MD(I)
2     END;
2
2   ERROR = LENGTH(TNS, TEW);
2   WRITE (;; TITLE, F1);
2   NSCF = -TNS/TMD;                                                            *WAS NSC = ...*
2   EWCF = -TEW/TMD;
2   TCD = 0; TCNS = 0; TCEW = 0;
2   FOR I = (1,1,N);
2     BEGIN
2     CNS(I) = NS(I) + MD(I).NSCF;
2     TCNS = TCNS + CNS(I);
2     CEW(I) = EW(I) + MD(I).EWCF;
2     TCEW = TCEW + CEW(I);
2     CD = LENGTH(CNS(I), CEW(I));
2     TCD = TCD + CD;
2     WRITE (;; ANSWERS, F2)
2     END;
2
2   CNS(N+1) = CNS(1);
2   CEW(N+1) = CEW(1);
2   SUM = 0;
2   NSLOC = 0; EWLOC = 0;
2   FOR I=(1,1,N);
2     BEGIN
2     NSLOC = NSLOC + CNS(I);
2     EWLOC = EWLOC + CEW(I);
2     SUM = SUM + (CNS(I+1)) (CEW(I+1) + 2EWLOC)
2     END;
2
2   SQFT = ABS(SUM)/2;
2   ACRES = SQFT/43560;
2   WRITE (;; TOTALS, F3);
2   GO TO START;
2
2 INPUT
2   IDENT (SURVEY, N),
2   STATION (K, D(I), M(K), S(I), Q(I), MD(I));
2 OUTPUT
2   TITLE (SURVEY, N, ERROR),
2   ANSWERS (I, D(I), M(I), S(I), Q(I), MD(I), CD, CNS(I), CEW(I)),
2   TOTALS (TMD, TCD, TCNS, TCEW, SQFT, ACRES);
2 FORMAT
2   F1 (*SURVEY*, I8, B5, *NUMBER OF LEGS*, I5, B5, *CLOSURE ERROR*,            *ADDED SPACING
2       X9.2, W1,
2       *LEG*, B5, *ANGLE*, B7, *MEASURED*, B5, *CORRECTED*, B3,
2       *NORTH-SOUTH    EAST-WEST*, W6,
2       *NO.   DD MM SS Q     DISTANCE      DISTANCE  DISPLACEMENT *,
2       *DISPLACEMENT*,2W),
2   F2 (I3, I5, 2I3, I2, 4X13.2, W),                                            *WAS F2,(...*
2   F3 (B6, *TOTALS*, B4, 4X13.2, W4, *AREA OF TRAVERSE*, X13.2,
2       * SQUARE FEET*, X13.2, * ACRES*, W6);                                   *ADDED SPACING
2 FINISH;
5 1234 7
5   1  62 30  0   2   137.0
5   2  29 30  0   2    83.8
5   3  73 30  0   2   124.4
5   4  39 30  0   1   149.8
5   5  39 30  0   3   111.7
5   6  88 30  0   4   266.5
5   7  54 30  0   4    52.0
5 9999 1 * DUMMY DATA SET TO FORCE A STOP
5   0   0  0  0   0     0.0
