Need help with this assignment. I have this code so far but in the assignment sa
ID: 3912406 • Letter: N
Question
Need help with this assignment.
I have this code so far but in the assignment says that I have to use a while loop.
@ echo off
setlocal enabledelayedexpansion
echo results.txt
echo Mike Corleone >> results.txt
set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2%
echo %dt% >> results.txt
goto :main
:main
setlocal
set /p choice1="Enter your first number"
set /p choice2="Enter your second number"
if !choice1! == 999 goto :eof
if !choice2! == 999 goto :eof
:loop
goto :loop
echo.
echoo ^^
endlocal
Part 1 - Worth 5 points. Using Windows Batch in command prompt. - Call this program programl.bat Implement mod (find the remainder), with error trapping, using if and while commands, How: - Append your name, current date and time to a NEW file called results.txt - Use a simulated while loop - If the user enters the value 999 for the first or the second number, you must exit the while loop immediately immediately. immediatelv socond umbor numbers in this computation using labels, and append them to t - Ask the user to enter the first number. If it is 999, exit - Ask the user to enter the second number. If it is 999, exit - If the second number is ZERO inform the user and ask for a correct 2e the Eecond nunber is NoT a zero, do the operation, diapay a results.txt fileExplanation / Answer
on improving your code..it will be :-(remember the loop closes only if first number or second number equals 999 , also if second number equals 0 we use a type of while loop asking to enter correct number , if second number not equals 0 or 999 it will display the values and writes them into txt file and continue the looping )
@ echo off
setlocal enabledelayedexpansion
echo results.txt
echo Mike Corleone >> results.txt
set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2%
echo %dt% >> results.txt
goto :main
:main
:loop
set /p choice1="Enter your first number"
if !choice1! == 999 goto :eof
set /p choice2="Enter your second number"
:while1
if !choice2! == 0 (
set /p choice2="Enter correct second number"
goto :while1
)
if !choice2! == 999 goto :eof
if NOT !choice2! == 0 goto :display
goto :loop
:display
echo !choice1!
echo !choice2!
echo !choice1!>>results.txt
echo !choice2!>>results.txt
goto :loop