『第
21 楼』:
通过在楼住的代码中新加代码,可以显示不同年份了
除了公元前估计都没有问题
所有改动均在注释之内,其余部分未做改动
@echo off
mode con: lines=12 cols=40
setlocal enabledelayedexpansion
for %%a in (一,二,三,四,五,六,日) do (
set /a a+=1
set j!a!=%%a)
for %%b in (31,28,31,30,31,30,31,31,30,31,30,31) do (
set /a y+=1
set s!y!=%%b)
::::::::::::::::::::::::::::::加入年功能
set /p year=查几年?
cls
set /a year_chk1=year%%400
set /a year_chk2=year%%4
set /a year_chk3=year%%100
if %year_chk1% equ 0 set s2=29
if %year_chk2% equ 0 if %year_chk3% neq 0 set s2=29
::::::::::::::::::::::::::::::加入结束
set /p m=查几月?
cls
set n=%m%
set /a n-=1
for /l %%c in (1,1,%n%) do (
set /a day+=!s%%c!)
set b=0
for /l %%d in (1,1,!day!) do (
set /a b+=1
if !b! equ 8 set b=1)
if %m% equ 1 set b=7
echo 一 二 三 四 五 六 日
echo.
set flag= 一二三四五六日一二三四五六日
:::::::::::::::::::::::::::::::::加入年功能
set /a yearflag=(%year%+(%year%-1)/4-(%year%-1)/100+(%year%-1)/400)%%7
if %yearflag% equ 1 goto endadjust
if %yearflag% equ 0 set yearflag=7
set /a yearflag-=1
set /a yeartemp=0-yearflag
set flag= !flag:~%yeartemp%!一二三四五六日一二三四五六日
set flag=!flag:~0,15!
echo %flag%>C:\ag.txt
:endAdjust
:::::::::::::::::::::::::::::::::加入结束
for /l %%f in (1 1 13) do (
if "!flag:~%%f,1!"=="!j%b%!" (
if "!j%%f!"=="一" (set /p s= <nul&set zh=6&goto next)
if "!j%%f!"=="二" (set /p s= <nul&set zh=5&goto next)
if "!j%%f!"=="三" (set /p s= <nul&set zh=4&goto next)
if "!j%%f!"=="四" (set /p s= <nul&set zh=3&goto next)
if "!j%%f!"=="五" (set /p s= <nul&set zh=2&goto next)
if "!j%%f!"=="六" (set /p s= <nul&set zh=1&goto next)
if "!j%%f!"=="日" (set /p s=<nul&set zh=7&goto next)
))
:next
for /l %%e in (1 1 !s%m%!) do (
set /a b+=1
if !b! equ 8 set b=1
if %%e lss 10 (set /p= %%e<nul) else (set /p= %%e<nul)
if !fl!==0 (set /a z+=1)
if !z!==7 (echo.&set z=0)
if %%e==!zh! (echo.
set fl=0
)
)
pause>nul [ Last edited by my3439955 on 2007-4-24 at 12:39 PM ]
|