How can i get the ASCII Value of the return key | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i get the ASCII Value of the return key

I woul like to check whether the user pushes the return key or not, and store it into a variable. How can I do that? for example: cin>>a; if(a=='ASCII-Value of the return button') {continue your programm} ; Or if there is any other possibility to check for the return button i would be thankful when you would share it with me.

26th Nov 2016, 7:47 AM
Dave Low
Dave Low - avatar
2 Answers
+ 2
Aditya told correctly. ASCII key of return is 13 just add 13 in the code
26th Nov 2016, 9:28 AM
Sandeep Chatterjee
+ 1
Thanks for the answers at both. It is true what you said how to check a value but Sandeep understood my question better i think. Because i wrote a small programm wich prints the Value of an ASCII sign. But now i wasn't able to insert the return key in my programm that it prints the ASCII value of the return button. (look my code for more information). So 13 is the information needed =)
26th Nov 2016, 10:30 AM
Dave Low
Dave Low - avatar