آموزش ساخت ماشین حساب با Batch File

یه ماشین حساب ساختم گفتم شاید به کارتون بیاد برای همین دستوراتشو گذاشتم batch file با استفاده از

دوره های شبکه، برنامه نویسی، مجازی سازی، امنیت، نفوذ و ... با برترین های ایران
echo off
color 0a
cls
echo hello i am a robot 
echo i can calculate for you
echo enter your name please
set /p name=
cls
echo welcome %name%
pause
:m
echo press 1 for Addition
echo press 2 for Subtraction
echo press 3 for Multiplication
echo press 4 for Division
echo press 5 for clearing the table
echo press 6 for exit
set /p type=
if %type%==1 goto a
if %type%==2 goto b
if %type%==3 goto c
if %type%==4 goto d
if %type%==5 goto e
if %type%==6 goto f
:a
echo Addition
echo choose the first number please
set /p n1=
echo now choose the second number
set /p n2=
echo ................................................................................
echo.     
echo  %n1%+%n2% 
echo.                                             
echo ................................................................................
echo press enter for geting the answer
pause
set /a an=n1+n2
echo ................................................................................
echo.
echo  %n1%+%n2%=%an%                                      
echo.
echo ................................................................................
echo press 1 for doing it again
echo press m for going to menu
set /p type=
if %type%==1 goto a
if %type%==m goto m
:b
echo Subtraction
echo choose the first number please
set /p n1=
echo now choose the second number
set /p n2=
echo ................................................................................
echo.
echo  %n1%-%n2%                                          
echo.
echo ................................................................................
echo press enter for geting the answer
pause
set /a an=n1-n2
echo ................................................................................
echo.
echo  %n1%-%n2%=%an%                                     
echo.
echo ................................................................................
echo press 2 for doing it again
echo press m for going to menu
set /p type=
if %type%==2 goto b
if %type%==m goto m
:c
echo Multiplication
echo choose the first number please
set /p n1=
echo now choose the second number
set /p n2=
echo ...............................................................................
echo.
echo  %n1%*%n2%                                        
echo.
echo ...............................................................................
echo press enter for geting the answer
pause
set /a an=n1*n2
echo ...............................................................................
echo.
echo  %n1%*%n2%=%an%                                   
echo.
echo ...............................................................................
echo press 3 for doing it again
echo press m for going to menu
set /p type=
if %type%==3 goto c
if %type%==m goto m
:d
echo Division
echo choose the first number please
set /p n1=
echo now choose the second number
set /p n2=
echo ...............................................................................
echo.
echo  %n1%/%n2%                                      
echo.
echo ...............................................................................
echo press enter for geting the answer
pause
set /a an=n1/n2
echo ...............................................................................
echo.
echo  %n1%/%n2%=%an%                                 
echo.
echo ...............................................................................
echo press 4 for doing it again
echo press m for going to menu
set /p type=
if %type%==4 goto d
if %type%==m goto m
:e
echo Clearing cmd
echo press enter for clearing cmd
pause
cls
echo press m please
set /p type=
if %type%==m goto m
:f
cls
echo                                       Exit
echo.
echo.
echo                              ......................
echo                              .thanks for using me .
echo                              .  wish you luck     .
echo                              ......................
pause
exit

ذخیره کنین اونموقع شکل فایل شبیه چرخ دنده می شه بعدش فایل رو اجرا کنین bat شما باید همین دستوراتو توی نوت پد کپی کنید بعدش اونو با پسوند


نظرات