看到微博上有个歪果仁说的一个公式算年龄的,写成批处理玩一玩

@echo off
color 9f
title Game by Frank
::mod col=80
setlocal enabledelayedexpansion
echo This game is to get your age according to the entered number.
set /p FirstNumber=Please enter the first number that you have thought already :
set /a Result=(2*%FirstNumber%+5)*50
::echo !Result!
set /p BirFlag=Whether your birthday has been already passed or not? (Y/N) :
IF /i %BirFlag%=="Y" (set /a Result=!Result!+1766) ELSE (set /a Result=!Result!+1765)

set /p DOB=Please enter your birthday (yyyy) :
set /a Result=!Result!-%DOB%
set /a FirstNumber=!Result!/100
set /a Age =!Result!%%100
::echo !Result!
echo The number you chose : !FirstNumber!
echo And your age : !Age!
::echo on
::FOR /l %%i in (1,1,3) do (@echo )
echo %0 Thank you for running this game, and enjoy yourself^^!
pause>nul

结果如图:

如果有来生,一个人去远行,看不同的风景,感受生命的活力。。。
原文地址:https://www.cnblogs.com/Frank99/p/5527444.html