你好,我有一个问题。如何通过用户输入找到删除键的ascii值 [英] Hello I have a question. How can I find the ascii value of the delete key by user input
本文介绍了你好,我有一个问题。如何通过用户输入找到删除键的ascii值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过用户输入或cin获取删除键的ascii值。
我尝试过:
我知道删除键的ascii值为127.
我也可以通过以下方式获得:
static_cast< ; int>('/ x7f')或类似的序列,但我需要通过用户输入获取它。我怎么能这样做?
I need to get the ascii value of delete key by user input or cin.
What I have tried:
I know the delete key has an ascii value of 127.
I can also get this by using:
static_cast<int>('/x7f') or some similar sequence, but i need to get it via user input. How can i do that?
推荐答案
我记得在大学期间我们曾经做过类似的事情,因为我不再使用C ++了。检查是否有帮助 -
I remember we used to do something like following during college days as I no more use C++. Check if it helps-
char c;
c=getch();
cout << "Code for key pressed" << c;
希望,它有帮助:)
Hope, it helps :)
这篇关于你好,我有一个问题。如何通过用户输入找到删除键的ascii值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文