10 'Tested on CP/M and Added CLS change 18 July 87, Jim Lill
20 'fixed misspellings and redundancies in data
30 CLS$=CHR$(26):' set for your terminal
40 C%=330:' THIS IS NUMBER OF CITIES
50 DIM A1%(26)
60 DIM N$(C%),LA(C%),LO(C%)
70 PI= 4 * ATN(1):'added in CP/M conversion
80 PI2=2 * PI
90 DG=360/PI2 '2 pi radians in 360 degrees
100 'arc cosine function using arc tangent & sin2(x) + cos2(x) = 1
110 DEF FNACOS(V1)=ATN(SQR(1-V1*V1)/V1)*DG 'answer returned in degrees
120 'GREAT CIRCLE MILEAGE
130 'Note: If you wish to add cities to the data list, they
140 'must be inserted alphabetically (by first letter only), and the
150 'value of "C%" (in the first line) increased accordingly.
160 'The data for each city is the name, latitude and longitude.
170 'Latitude is +/- 90 degrees.  Negative values are below the equator.
180 'Longitude is +/- 180 degrees.  Negative values are East of Greenwich.
190 'Duplicate entries arise when data sources disagree on lat/long.
200 PRINT CLS$:PRINT "AIRLINE DISTANCES BETWEEN CITIES"
210 PRINT:PRINT:PRINT"If you are not sure of the spelling of a city,"
220 PRINT "type in only the first letters of which you are confident."
230 PRINT
240 PRINT "All entries must be in UPPER CASE."
250 PRINT:PRINT "PLEASE WAIT FOR ARRAYS TO BE SET UP."
260 X%=1 'Index to letters of alphabet
270 FOR Y=1 TO C%: READ N$(Y),LA(Y),LO(Y)
280 'Find data positions for each letter of the alphabet
290 'Brackets search positions and makes database updates easier.
300 IF ASC(LEFT$(N$(Y),1))<=64+X% THEN GOTO 330 'First occurrence of new letter
310 A1%(X%)=Y-1:X%=X%+1 'Number of last city in the list with letter# X%
320 GOTO 300 'In case no cities started with X%-1
330 NEXT Y
340 A1%(26)=C% 'guarantee last entry
350 PRINT
360 INPUT "TYPE IN CITY OF ORIGIN ";A$
370 GOSUB 560
380 IF C1%>0 THEN GOTO 400
390 PRINT "NO CITY SELECTED":PRINT:GOTO 550
400 LAT1=LA(C1%)/DG:LONG1=LO(C1%)/DG:L$=N$(C1%)
410 PRINT
420 INPUT "TYPE IN DESTINATION CITY NAME ";A$
430 GOSUB 560
440 IF C1%>0 THEN GOTO 460
450 PRINT "NO CITY SELECTED":PRINT:GOTO 550
460 LAT2=LA(C1%)/DG:LONG2=LO(C1%)/DG:M$=N$(C1%)
470 DAB=SIN(LAT1)*SIN(LAT2)+COS(LAT1)*COS(LAT2)*COS(LONG1-LONG2)
480 DIST=ABS(FNACOS(DAB))
490 PRINT Z$
500 PRINT"THE DISTANCE FROM "L$" TO "M$" IS:"
510 PRINT USING "#####,.#";DIST*69.113;:PRINT" STATUTE MILES  ";
520 PRINT USING "#####,.#";DIST*60.0576;:PRINT" NAUTICAL MILES  ";
530 PRINT USING "#####,.#";DIST*111.203;:PRINT" KILOMETERS"
540 PRINT
550 INPUT "RUN AGAIN? ",A$: IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="Y" THEN GOTO 350 ELSE END
560 'Subroutine to find the city's name.
570 T=ASC(LEFT$(A$,1))-64  'Number (1-26) of first letter of city name.
580 BOT%=A1%(T-1)+1:TOP%=A1%(T)
590 'First & last cities starting with this letter.
600 'A1%(T-1) is the last position of the letter before this one.
610 'Thus the next one, A1%(T-1)+1, must be the first one with this letter.
620 'Your version of Basic must allow A1%(0) to exist or this won't work
630 'when a city begins with "A".
640 IF LEN(A$)>1 THEN GOTO 720 'Go try and match spelling
650 FOR M%=BOT% TO TOP% 'For each city
660 TT=24*(M% MOD 3)
670 PRINT M%;N$(M%);TAB(TT); 'Print a list of name & number
680 NEXT M%
690 PRINT:PRINT "CHOOSE THE NUMBER OF THE CITY YOU WANT"
700 INPUT "ENTER 0, TO QUIT";C1%
710 RETURN
720 'If more than one letter is given, try to match spelling.
730 C1%=0:J=0
740 FOR M%=BOT% TO TOP%
750 IF LEFT$(N$(M%),LEN(A$))=A$ THEN PRINT M%,N$(M%) :C1%=M%:J=J+1
760 NEXT
770 IF J=1 THEN RETURN
780 IF C1%<>0 THEN GOTO 690 ELSE GOTO 650
790 DATA ABILENE, 32.4514 , 99.7308, ACAPULCO, 16.85 , 99.9333
800 DATA ADDIS ABABA, 9.05 ,-38.7 ,AKRON, 41.0833 , 81.5122
810 DATA ALBANY, 42.6502 , 73.7502 ,ALBUQUERQUE, 33.0836 , 106.651
820 DATA ALLENTOWN, 40.6031 , 75.4683 ,ALTOONA, 40.5153 , 78.4008
830 DATA AMARILLO, 35.2075 , 101.834 ,AMSTERDAM, 52.35 ,-4.9
840 DATA ANCHORAGE, 61.1667 , 149.983 ,ANKARA, 39.9167 ,-32.8333
850 DATA ANN ARBOR, 42.2831 , 83.7478 ,ASHVILLE, 35.595 , 82.5572
860 DATA ATHENS, 37.9667 ,-23.7333 ,ATLANTA, 33.6381 , 84.4278
870 DATA AUGUSTA GA, 33.4722 , 81.9667 ,AUGUSTA ME, 44.3147 , 69.7747
880 DATA AUSTIN, 30.2692 , 97.7436 ,BAKERSFIELD, 35.3753 , 119.022
890 DATA BALBOA, 8.95 , 79.5667 ,BALTIMORE, 39.0175 , 76.67
900 DATA BANGOR, 44.8036 , 68.7717 ,BARCELONA, 41.4167 ,-2.1667
910 DATA BATON ROUGE, 30.4494 , 91.1833 ,BATTLE CREEK, 42.3161 , 85.18
920 DATA BEAUMONT, 30.3467 , 94.1025 ,BELFAST, 54.6667 , 5.833
930 DATA BELLINGHAM, 48.7594 , 122.467 ,BERKELEY, 37.8694 , 122.271
940 DATA BERLIN, 52.5333 ,-13.0833 ,BERN, 46.95 ,-7.3333
950 DATA BETHLEHEM, 40.6211 , 75.3761 ,BILLINGS, 45.7928 , 108.501
960 DATA BILOXI, 30.3967 , 88.8833 ,BINGHAMTON, 42.2075 , 75.9794
970 DATA BIRMINGHAM, 33.5169 , 86.81 ,BISMARCK, 46.8064 , 100.788
980 DATA BLOOMINGTON, 40.4828 , 88.9933 ,BOGOTA, 4.6333 , 74.0833
990 DATA BOISE, 43.6186 , 116.199 ,BOMBAY, 18.9333 ,-72.85
1000 DATA BOSTON, 42.3642 , 71.0056 ,BOWLING GREEN, 36.9947 , 86.4425
1010 DATA BRIDGEPORT, 41.1803 , 73.1894 ,BRISBANE,-27.5 ,-153
1020 DATA BRISTOL, 36.5833 , 82.2 ,BROCKTON, 42.0839 , 71.0236
1030 DATA BROWNSVILLE, 25.9019 , 97.4994 ,BRUSSELLS, 50.8333 ,-4.35
1040 DATA BUFFALO, 42.9406 , 78.7325 ,BURLINGTON VT, 44.4761 , 73.2128
1050 DATA BUTTE, 46.0183 , 112.536 ,CALCUTTA, 22.5833 ,-88.35
1060 DATA CAMBRIDGE, 42.3669 , 71.1061 ,CAMDEN, 39.9447 , 75.1206
1070 DATA CANBERRA,-35.3 ,-149.133 ,CANTON, 40.7972 , 81.3769
1080 DATA CARACAS, 10.5833 , 60.9333 ,CARSON CITY, 39.1667 , 119.767
1090 DATA CASABLANCA, 33.65 , 7.5833 ,CEDAR RAPIDS, 41.9669 , 91.6647
1100 DATA CEDAR RAPIDS, 41.8844 , 91.7086 ,CHAMPAIGN, 40.0397 , 88.2781
1110 DATA CHAMPAIGN, 40.118 , 88.2467 ,CHARLESTON SC, 32.8986 , 80.04
1120 DATA CHARLESTON WV, 38.3731 , 81.5933 ,CHARLOTTE, 35.2147 , 80.9383
1130 DATA CHATTANOOGA, 35.0447 , 85.3089 ,CHEYENNE, 41.1358 , 104.819
1140 DATA CHICAGO, 41.9825 , 87.9069 ,CINCINNATI, 39.0478 , 84.6667
1150 DATA CLARKSBURG, 39.2956 , 80.2289 ,CLEVELAND, 41.4103 , 81.8489
1160 DATA COLORADO SPRINGS, 38.8353 , 104.821 ,COLUMBIA, 34.0006 , 81.0333
1170 DATA COLUMBUS, 39.9947 , 82.8856 ,COLUMBUS GA, 32.4686 , 84.99
1180 DATA CONCORD, 43.2061 , 71.5403 ,CORPUS CHRISTI, 27.7975 , 97.3959
1190 DATA DAKAR, 14.6333 , 17.3333 ,DALLAS, 32.8967 , 97.0336
1200 DATA DAVENPORT, 41.5219 , 90.5758 ,DAYTON, 39.9011 , 84.22
1210 DATA DAYTONA BEACH, 29.2122 , 81.0194 ,DECATUR, 39.845 , 88.9464
1220 DATA DECATUR, 39.8342 , 88.8681 ,DENVER, 39.7742 , 104.878
1230 DATA DES MOINES, 41.4872 , 93.6167 ,DETROIT, 42.2153 , 83.3486
1240 DATA DODGE CITY, 37.7547 , 100.019 ,DUBLIN, 53.3333 , 6.25
1250 DATA DUBUQUE, 42.4986 , 90.6689 ,DULUTH, 46.7822 , 92.1067
1260 DATA DURHAM, 36 , 78.9125 ,EAU CLAIRE, 44.8086 , 91.4969
1270 DATA EL PASO, 31.78 , 106.486 ,ELIZABETH, 40.6619 , 74.2164
1280 DATA ELMIRA, 42.1595 , 76.8925 ,ENID, 36.3944 , 97.8764
1290 DATA EUGENE, 44.0544 , 123.092 ,EVANSVILLE, 37.9722 , 87.5725
1300 DATA FAIRBANKS, 64.8 , 147.85 ,FARGO, 46.875 , 96.7883
1310 DATA FLAGSTAFF, 35.1933 , 111.652 ,FLINT, 43.0139 , 83.6925
1320 DATA FRANKFURT, 50.1 ,-8.6833 ,FRESNO, 36.7367 , 119.786
1330 DATA FT. SMITH, 35.3861 , 94.4267 ,FT. WAYNE, 41.0725 , 85.1406
1340 DATA FT. WORTH, 32.7486 , 97.3289 ,GADSDEN, 34.0158 , 86.0114
1350 DATA GAINSVILLE, 29.6486 , 82.3219 ,GALLOP, 35.525 , 108.742
1360 DATA GALVESTON, 29.3028 , 94.7953 ,GARY, 41.6033 , 87.3386
1370 DATA GENOA, 44.4 ,-8.9333 ,GLASGOW, 55.8833 , 4.6833
1380 DATA GRAND JUNCTION, 39.0683 , 108.565 ,GRAND RAPIDS, 42.9675 , 85.6703
1390 DATA GREAT FALLS, 47.4925 , 111.306 ,GREEN BAY, 44.4106 , 88.0139
1400 DATA GREENSBORO, 36.0714 , 79.7903 ,GREENVILLE, 34.8964 , 82.2186
1410 DATA GUADALAJARA, 20.5 , 103.333 ,GUAYAQUIL,-2.5167 , 79.9
1420 DATA GULFPORT, 30.3678 , 89.0933 ,HALIFAX, 44.6442 , 63.5761
1430 DATA HARRISBURG, 40.2019 , 76.8831 ,HARTFORD, 41.7361 , 72.6506
1440 DATA HARTFORD, 41.77 , 72.6803 ,HELENA, 46.4925 , 112.04
1450 DATA HELSINKI, 60.1355 ,-25 ,HILO, 19.725 , 155.09
1460 DATA HOLYOKE, 42.2081 , 72.61 ,HONOLULU, 21.3061 , 157.86
1470 DATA HOUSTON, 29.9828 , 95.3458 ,HUNTINGTON, 38.3667 , 82.5581
1480 DATA HUNTINGTON, 38.42 , 82.4425 ,HUNTSVILLE, 34.7383 , 86.5886
1490 DATA INDIANAPOLIS, 39.7244 , 86.2833 ,ITHACA, 42.4903 , 76.4578
1500 DATA JACKSON MI, 42.2453 , 84.4061 ,JACKSON MS, 32.2989 , 90.185
1510 DATA JACKSONVILLE, 30.4925 , 81.69 ,JERSEY CITY, 40.7306 , 74.0656
1520 DATA JERUSALEM, 31.7833 ,-35.2167 ,JOHANNESBURG,-26.1667 ,-28.0333
1530 DATA JOPLIN, 37.0906 , 90.7031 ,JUNEAU, 58.3033 , 134.408
1540 DATA KANSAS CITY, 39.2992 , 94.7178 ,KNOXVILLE, 35.9608 , 83.9186
1550 DATA LAFAYETTE, 40.4197 , 86.8942 ,LANCASTER, 40.0403 , 76.3081
1560 DATA LANSING, 42.7336 , 84.5542 ,LAREDO, 27.5061 , 99.5083
1570 DATA LAS VEGAS, 36.08 , 115.152 
1580 DATA LENINGRAD, 59.9167 ,-30.4167 ,LEXINGTON, 38.0367 , 84.6058
1590 DATA LIMA OH, 40.7431 , 84.1056 ,LIMA PERU,-12.1 , 77.05
1600 DATA LINCOLN, 40.8164 , 96.7042 ,LISBON, 38.7333 , 9.1333
1610 DATA LITTLE ROCK, 34.7303 , 92.2331 ,LIVERPOOL, 53.7167 , 1.6833
1620 DATA LONDON, 51.5 , 0 ,LONG BEACH, 33.7706 , 118.188
1630 DATA LOS ANGELES, 33.9419 , 118.406 ,LOUISVILLE, 38.1778 , 85.7364
1640 DATA LOWELL, 42.6403 , 71.3206 ,LUBBOCK, 33.5847 , 101.843
1650 DATA LUXEMBOURG, 49.6167 ,-6.1333 ,MACON, 32.8367 , 83.6267
1660 DATA MADISON, 43.0731 , 89.3819 ,MADISON, 43.1389 , 89.3375
1670 DATA MADRID, 40.4167 , 3.7167 ,MALAGA, 36.7167 , 4.4167
1680 DATA MARSHALL, 32.55 , 94.3833 ,MEMPHIS, 35.05 , 89.9789
1690 DATA MEXICO CITY, 19.4292 , 99.1167 ,MIAMI, 25.7944 , 80.2881
1700 DATA MILWAUKEE, 42.948 , 87.8964 ,MINNEAPOLIS, 44.8842 , 93.215
1710 DATA MINOT, 48.2358 , 101.294 ,MOBILE, 30.6933 , 88.0425
1720 DATA MOLINE, 41.4486 , 90.5081 ,MONTERREY, 25.6667 , 100.333
1730 DATA MONTGOMERY, 32.3758 , 86.3086 ,MONTIVIDEO,-17.55 , 51.1333
1740 DATA MONTPELIER, 44.26 , 72.5781 ,MONTREAL, 45.5083 , 73.5556
1750 DATA MOSCOW, 55.75 ,-37.7 ,NASHVILLE, 36.1267 , 86.6819
1760 DATA NASSAU, 25.0833 , 77.3333 ,NATCHEZ, 31.5633 , 91.3917
1770 DATA NEW BEDFORD, 42.6369 , 70.9281 
1780 DATA NEW DELHI, 28.6333 ,-77.2 ,NEW HAVEN, 41.3069 , 72.925
1790 DATA NEW ORLEANS, 29.9928 , 90.2564 ,NEW YORK JFK, 40.6403 , 73.7783
1800 DATA NEW YORK LGA, 40.7772 , 73.8742 ,NEWARK, 40.6931 , 74.1686
1810 DATA NIAGARA FALLS, 43.0928 , 79.0572 ,NOME, 64.5 , 165.417
1820 DATA NORFOLK, 36.8953 , 76.2 ,OAKLAND, 37.8008 , 122.265
1830 DATA OGDEN, 41.2253 , 111.973 ,OKLAHOMA CITY, 35.3936 , 97.5997
1840 DATA OMAHA, 41.3011 , 95.885 ,ORLANDO, 28.4317 , 81.3247
1850 DATA OSLO, 59.9333 ,-10.75 ,OTTAWA, 45.4278 , 75.7125
1860 DATA PADUCAH, 37.0869 , 88.5989 ,PALERMO, 38.1333 ,-13.3833
1870 DATA PANAMA CITY FL, 30.1667 , 85.6833 ,PARIS, 48.8372 ,-2.3372
1880 DATA PASADENA, 34.1456 , 118.145 ,PEKING, 39.9 ,-116.467
1890 DATA PENSACOLA, 30.4142 , 87.2156 ,PEORIA, 40.6642 , 89.69
1900 DATA PERTH,-31.9667 ,-115.817 ,PHILADELPHIA, 39.8703 , 75.2453
1910 DATA PHOENIX, 33.4361 , 112.009 ,PIERRE, 44.3717 , 100.348
1920 DATA PITTSBURGH, 40.4936 , 80.2317 ,POCATELLO, 42.8606 , 112.45
1930 DATA PORT ARTHUR, 29.875 , 93.9375 
1940 DATA PORTLAND ME, 43.6592 , 70.2553 ,PORTLAND OR, 45.5183 , 122.676
1950 DATA PRAGUE, 49.65 ,-13.8167 ,PROVIDENCE, 41.8256 , 71.4114
1960 DATA PROVO, 40.235 , 111.657 ,PUEBLO, 38.2714 , 104.609
1970 DATA QUEBEC, 46.8128 , 71.2056 ,QUITO,-.14 , 78.3
1980 DATA RACINE, 42.7303 , 87.7867 ,RALEIGH, 35.7772 , 78.6392
1990 DATA RAPID CITY, 44.0811 , 103.22 ,READING, 40.3358 , 75.9278
2000 DATA RENO, 39.5242 , 119.811 
2010 DATA RICHMOND, 37.5375 , 77.4358 ,RIO DE JANEIRO,-22.8953 , 43.2228
2020 DATA ROANOKE, 37.2703 , 79.9456 ,ROCHESTER NY, 43.1189 , 77.6728
2030 DATA ROCKFORD, 42.2686 , 89.0967 ,ROME, 41.8833 ,-12.5 
2040 DATA SACREMENTO, 38.5825 , 121.495 ,SAGINAW, 43.4311 , 83.9347
2050 DATA SALEM OR, 44.94 , 123.033 ,SALINA, 38.8433 , 97.6128
2060 DATA SALT LAKE CITY, 40.7842 , 111.967 ,SAN ANGELO, 31.4608 , 100.434
2070 DATA SAN ANTONIO, 29.5333 , 98.4697 ,SAN BERNADINO, 34.1083 , 117.291
2080 DATA SAN DIEGO, 32.7336 , 117.187 ,SAN FRANCISCO, 37.6194 , 122.374
2090 DATA SAN JOSE, 37.3614 , 121.927 ,SAN JUAN, 18.4414 , 66.0022
2100 DATA SAN SALVADOR, 13.6667 , 89.1667 ,SANTA BARBABRA, 34.4217 , 119.699
2110 DATA SANTA FE, 35.6864 , 105.936 ,SANTIAGO,-33.5 , 70.4
2120 DATA SAO PAULA,-23.55 , 46.65 ,SARASOTA, 27.3347 , 82.5417
2130 DATA SAVANNAH, 32.0783 , 81.0936 ,SCHENECTADY, 42.8117 , 73.9283
2140 DATA SCRANTON, 41.4089 , 75.6628 ,SEATTLE, 47.4492 , 122.308
2150 DATA SHANGHAI, 31.2167 ,-121.417 ,SHEBOYGAN, 43.7628 , 87.7144
2160 DATA SHERIDAN, 44.7986 , 106.953 ,SHREVEPORT, 32.5128 , 93.7494
2170 DATA SINGAPORE, 1.3333 ,-103.833 ,SIOUX CITY, 42.4961 , 96.075
2180 DATA SIOUX FALLS, 43.5431 , 96.7264 ,SOUTH BEND, 41.6758 , 86.2503
2190 DATA SPARTANBURG, 34.9508 , 81.935 ,SPOKANE, 47.6589 , 117.426
2200 DATA SPRINGFIELD, 39.8433 , 89.6678 ,ST. JOSEPH, 39.7658 , 94.8506
2210 DATA ST. LOUIS, 38.7481 , 90.3622 ,ST. PAUL, 44.9553 , 93.1019
2220 DATA PETERSBURG, 27.7717 , 82.6386 ,STANFORD, 41.0525 , 73.54
2230 DATA STOCKHOLM, 59.3333 ,-18.95 ,STOCKTON, 37.9583 , 121.288
2240 DATA SYDNEY,-33.8667 ,-151.2 
2250 DATA SYRACUSE, 43.1122 , 76.1089 ,TACOMA, 47.2497 , 122.438
2260 DATA TALLAHASSEE, 30.4417 , 84.2822 ,TAMPA, 27.9739 , 82.5328
2270 DATA TEHERAN, 35.6667 ,-51.4333 ,TEL AVIV, 32.0833 ,-34.7667
2280 DATA TENERIFE, 28.25 , 16.588 ,TERRE HAUTE, 39.4675 , 87.4072
2290 DATA TEXARKANA, 33.43 , 94.0417 ,TOKYO, 35.75 ,-139.75
2300 DATA TOLEDO, 41.6539 , 83.5442 ,TOPEKA, 39.0544 , 95.6731
2310 DATA TORONTO, 43.6533 , 79.3833 ,TRENTON, 40.2206 , 74.7703
2320 DATA TUCSON, 32.2208 , 110.969 ,TULSA, 36.1986 , 95.8878
2330 DATA UTICA, 43.1033 , 75.2258 ,VANCOUVER, 49.275 , 123.125
2340 DATA VICTORIA, 48.4278 , 123.363 ,WACO, 31.5533 , 97.1333
2350 DATA WARSAW, 52.25 ,-21 ,WASHINGTON, 38.9436 , 77.4544
2360 DATA WATERLOO, 42.4944 , 92.3389 ,WEST PALM BEACH, 26.71 , 80.0519
2370 DATA WHEELING, 40.0675 , 80.7222 ,WHITE PLAINS, 41.0333 , 73.7633
2380 DATA WHITEHORSE, 60.7208 , 136.054 ,WICHITA, 37.6517 , 97.4308
2390 DATA WICHITA FALLS, 33.9094 , 98.4911 ,WILKESBARRE, 41.2422 , 75.8881
2400 DATA WILMINGTON DE, 39.7461 , 75.5475 ,WILMINGTON NC, 34.2372 , 77.9494
2410 DATA WINDSOR, 42.3306 , 83.05 ,WINNIPEG, 49.8989 , 97.1389
2420 DATA WINSTON-SALEM, 36.0978 , 80.245 ,WORCESTER, 42.2603 , 71.8047
2430 DATA YAKIMA, 46.6025 , 120.511 ,YONKERS, 40.9319 , 73.8983
2440 DATA YORK, 39.9597 , 87.7267 ,YOUNGSTOWN, 41.0992 , 80.6506
2450 DATA YUMA, 32.715 , 114.623 ,ZANESVILLE, 39.9383 , 82.0083
2460 DATA ZURICH, 47.3833 ,-8.55
2470 'Norman Goldsmith
2480 '5 Ranger Road
2490 '7/5/87
3 ,ZANESVILLE, 39.9383 , 82.0083
2460 DATA ZURICH