+ 1

print a to z without any loop on press of any key in keyboard . how can you solve it?

17th Feb 2022, 6:51 AM
Prachi Paliwal
4 odpowiedzi
+ 4
print("abcdefghijklmnopqrstuvwxyz")
17th Feb 2022, 6:53 AM
Simba
Simba - avatar
17th Feb 2022, 7:09 AM
NEZ
NEZ - avatar
0
All letters have their numerical codes. I don't know what programming language you are using, so I will be as general as possible. Let's assume A has code 45 (it is not, but we are about method, not realization). Then B will be 46 and so on. We have 26 letters. Initiation: CurrentCode = 45; Event on keyboard key pressed: PrintLetterByCode( CurrentCode ); CurrentCode + 1; IF ( CurrentCode == 45+26 ) THEN CurrentCode = 45; Adopt to your kanguage and bind event on keypress. Loop without looping. Only condition.
17th Feb 2022, 9:42 AM
Viktor Tsybenko