Write a program that will move a character from left to rightand then back again
ID: 3762912 • Letter: W
Question
Write a program that will move a character from left to rightand then back again across the monitor of the PC a number of timesas specified by the user's input. The user is to be promptedfor the character to display and how many times to move it back andforth. An input of '?' and 1 would cause the '?' to move backand forth across the monitor 1 trip. Your program must only allow entry of numbers from 1 to 5inclusive. Use a loop that allows an exit only if the valueis greater than zero and less than six. If the user enters anillegal value you must remind him/her of the values that areallowed and re-prompt for the numeric value. You do not haveto do any error checking on the character as any printablecharacter is fine. Remember if you have just displayed a character the cursor willbe just to the right of it. In order to display the nextcharacter you will have to erase the previous character and thendisplay the character in the new location. The backspacecharacter is character number 8 and a space is character number32. Do not display a character in the 80th position as thiswill cause the cursor to advance to the next line. All outputmust be on the same line.
Explanation / Answer
main proc
_Begin
CallGetChar
CallGetNum
CallDisplayChar
_Exit0
main endp
Delay proc
Push ecx;
mov ecx,5000000
CharTop:
Nop
Dececx
JnzCharTop
Popecx
Ret
Delay endp
GetChar proc
Ret
GetChar endp
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.