How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the Batch File programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the Batch File programming language
Table of Contents
Problem Statement
Obtain a valid Y or N response from the keyboard. The keyboard should be flushed, so that any outstanding key-presses are removed, preventing any existing Y or N key-press from being evaluated. The response should be obtained as soon as Y or N are pressed, and there should be no need to press an enter key.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the Batch File programming language
Source code in the batch programming language
@echo off
choice
if errorlevel 2 echo You chose N
if errorlevel 1 echo You chose Y
>nul pause
You may also check:How to resolve the algorithm Empty program step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Wireworld step by step in the Yabasic programming language
You may also check:How to resolve the algorithm Roman numerals/Decode step by step in the Factor programming language
You may also check:How to resolve the algorithm Hostname step by step in the Run BASIC programming language
You may also check:How to resolve the algorithm Base64 decode data step by step in the FreeBASIC programming language