home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Falcon 030 Power 2
/
F030_POWER2.iso
/
ST_STE
/
MAGS
/
ICTARI03.ARJ
/
ictari.03
/
STOS
/
DAYDATE.ASC
< prev
next >
Wrap
Text File
|
1987-04-22
|
4KB
|
92 lines
90 rem--->Calendar to name any day. "daydate.bas" in STOS Basic.
91 rem--->Les.Barclay-my program except the 'clever lines' 1740
92 rem--->1740-1770 and they make it work.
93 rem--->Runs in any mode.
94 rem'*********************************************************
95 rem
1000 gosub 1260 : rem------>initiate
1010 while I$<>"Q" : rem--->Set 1160-1200
1020 gosub 1440 : rem------>date input
1030 gosub 1740 : rem------>calculate day
1040 gosub 1100 : rem------>print result
1050 wend
1060 windel 1 : windel 2 : windel 3 : curs on : cls : show : end
1070 rem----------------------------
1080 rem>>>> PRINT RESULT <<<<
1090 rem----------------------------
1100 qwindow 3 : clw : curs off : print : centre L$
1110 DI$="The"+str$(D)+TH$+" of "+MOTH$+str$(YEAR)
1120 locate 1,3 : centre DI$
1130 DI$="is,was or will be a "+DAY$
1140 locate 1,4 : centre DI$
1150 qwindow 2 : clw : centre "Quit OR Again ?"
1160 clear key : I$=""
1170 repeat
1180 I$=upper$(inkey$)
1190 until I$<>""
1200 return
1210 rem-----------------------------
1220 rem>>>> INITIATE <<<<
1230 rem-----------------------------
1240 if mode=2 then then GR=2 : BL=2;BR=2
1250 if mode=0 then GR=9 : BL=13 : BR=5
1260 cls : hide : paper GR : windopen 1,0,0,80/divx,24,1 : clw
1270 paper BL : windopen 3,8/divx,13,64/divx,8,8 : clw : under on : title " DAY and DATE requested " : under off
1280 paper 1 : pen 0 : windopen 2,8/divx,22,64/divx,3,1 : clw
1290 paper BR : pen 1 : windopen 4,8/divx,2,64/divx,10,12 : clw : under on : title " PERPETUAL CALENDAR " : under off
1300 locate 1,2 : centre "The Gregorian calendar was "
1310 locate 1,3 : centre "introduced by pope Gregory in "
1320 locate 1,4 : centre "the year 1582 and made law in "
1330 locate 1,5 : centre "Britain and the colonies in "
1340 locate 1,6 : centre "1752. The algorithm used was "
1350 locate 1,7 : centre "written in 1886 by Zellar. "
1360 rem--->NOTE spaces to make strings equal length
1370 M$="January February March April May June July August SeptemberOctober November December "
1380 MK$="Tuesday WednesdayThursday Friday "
1390 WKD$="SaturdaySunday Monday "
1400 return
1410 rem---------------------------
1420 rem >>>> DATE INPUT <<<<
1430 rem---------------------------
1440 qwindow 2 : clw : repeat
1450 input "ENTER YEAR 1752-9999 ";Y : YEAR=Y : rem-->y is DEC line 1510
1460 until Y>1751 and Y<10000
1470 rem---> SET LEAP YEAR century/400 & year/4
1480 LEAP=0 : CENT=0 : DY=31 : C#=Y
1490 if int(C#/1000)=C#/1000 then CENT=1 : rem-->find end century
1500 if int(C#/400)=C#/400 then LEAP=1 : rem----->is it a leap year
1510 if CENT<>1 and int(C#/4)=C#/4 then LEAP=1 : rem-->? other leaps
1520 repeat
1530 input "month 1-12 ";M
1540 until M>0 and M<13
1550 rem--->days in month use month & leap
1560 DY$="31"
1570 if M=4 or M=6 or M#=9 or M=11 then DY$="30"
1580 if M=2 and LEAP=1 then DY$="29"
1590 if M=2 and LEAP=0 then DY$="28"
1600 MTH$=mid$(M$,M*9-8,9)
1610 if LEAP=1 then L$=str$(Y)+" was a leap year." else L$=" "
1620 repeat
1630 print "ENTER day 1 to ";DY$; : input " ";D
1640 until D>0 and D<val(DY$)+1
1650 rem--->set ordinals
1660 TH$="th"
1670 if D=1 or D=21 or D=31 then TH$="st"
1680 if D=2 or D=22 then TH$="nd"
1690 if D=3 or D=23 then TH$="rd"
1700 return
1710 rem-------------------------------
1720 rem>>>> CALCULATE DAY <<<<
1730 rem-------------------------------
1740 if M<3 then M=M+12 : dec Y
1750 W=D+2*M+2+int((3*M+3)/5)+Y+(Y/4)-int(Y/100)+int(Y/400)
1760 W=W-7*int(W/7)
1770 if W>2 then W=W-3 : DAY$=mid$(MK$,1+W*9,9) else DAY$=mid$(WKD$,1+W*8,8)
1780 rem
1790 rem--->get spaces off month string
1800 MOTH$="" : for N=1 to 9
1810 if mid$(MTH$,N,1)<>" " then MOTH$=left$(MTH$,N)
1820 if mid$(MTH$,N,1)=" " then N=9 : rem finish loop
1830 next N
1840 return