Ma first batch progs

Austin

Well-Known Member
Messages
1,970
Ball game:
Code:
@echo off
:sta
cls
echo Welcome to Zezombia's ball game!
SET /P name1=What's the name of the first player: 
cls
echo Alright, so the first player's name is %name1%.
SET /P name2=What's the name of the second player: 
cls
echo %name1% and %name2%, good enough!
SET /P dis1=How many meters should %name1% try to throw the ball: 
cls
SET /P dis2=And how about %name2%: 
SET /A Ran1=%random:~-1%*%dis1%
SET /A Ran2=%random:~-1%*%dis2%
cls
echo %name1% trys to shoot for %dis1% meters... and gets %Ran1%
echo %name2% trys to shoot for %dis2% meters... and gets %Ran2%
if %Ran1% GTR %Ran2% goto nex
echo %name2% is the winner!
goto end
:nex
echo %name1% is the winner!
:end
SET /P ply=Play again (Y/N): 
if %ply%==Y goto sta

Calculator:
Code:
@echo off
SET /P var=Type 1 for add, 2 for subtract, 3 for multiply, or 4 for divide: 
if %var%==1 goto add
if %var%==2 goto sub
if %var%==3 goto mul
if %var%==4 goto div
goto inv
:add
SET /P num1=Type the first number you want to add: 
SET /P num2=Type the second number you want to add: 
SET /A ans=%num1%+%num2%
echo The answer is %ans%
goto end
:sub
SET /P num1=Type the first number you want to subtract: 
SET /P num2=Type the second number you want to subtract: 
SET /A ans=%num1%-%num2%
echo The answer is %ans%
goto end
:mul
SET /P num1=Type the first number you want to multiply: 
SET /P num2=Type the second number you want to multiply: 
SET /A ans=%num1%*%num2%
echo The answer is %ans%
goto end
:div
SET /P num1=Type the first number you want to divide: 
SET /P num2=Type the second number you want to divide: 
SET /A ans=%num1%/%num2%
echo The answer is %ans%
goto end
:inv
echo Invalid choise
:end
pause

<3

[attachment deleted by admin]
 
Re: Ma first batch prog

Nice what exactly is it? Looking at the code I'd say calculator? (I can't dl anything on this pc :/, I'll be on mine in 2 hours)
 
Re: Ma first batch prog

Sweet ^^ would be cool if you could throw the program into a fancy design :T
 
Re: Ma first batch prog

Batch? Design? Did I hear those two things in the same sentence :s?
I know you never said it, but u get ma drift xD.

Btw, made something else ^.
 
Back
Top Bottom