『楼 主』:
根据出生年或年龄求生肖
@echo off
:head
cls
echo.
echo ====================================
echo.
echo 输入1:出生年月查生肖
echo.
echo 输入2:年龄查生肖
echo.
echo 输入n:退出
echo.
echo ====================================
set /p var=请输入:
if /i %var%==1 goto top
if /i %var%==2 goto bottom
if /i %var%==n goto quit
goto head
:top
cls
set /p var=请输入您的出生年(N退出):
:quit
if /i %var%==n exit
if "%var%"=="" goto top
set str=鼠猪狗鸡猴羊马蛇龙兔虎牛
if %var% gtr %date:~0,4% (
echo 输入的年份不能大于%date:~0,4%年
pause>nul&goto top
)
set /a num=%date:~0,4%-2007,num%%=12
if %num%==0 goto out
if %num% gtr 0 (
for /l %%i in (%num%,-1,1) do (
call set str=%%str:~-1%%%%str:~0,-1%%
)
goto out
)
if %num% lss 0 set /a num=0-%num%
for /l %%i in (1,1,%num%) do (
call set str=%%str:~1%%%%str:~0,1%%
)
:out
set /a ss=%date:~0,4%-%var%+1
cls
echo.
echo.
echo ::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.::: :::
echo ::: 您今年%ss%岁 :::
set /a ss%%=12
echo.::: :::
call echo ::: 你属%%str:~%ss%,1%% :::
echo.::: :::
echo ::: 出生于%var%年 :::
echo.::: :::
echo ::::::::::::::::::::::::::::::::::::::::::::::::::::
pause>nul&goto head
:bottom
set /p var=请输入您的年龄:
set /a var=%date:~0,4%-%var%+1
goto quit
|