方向键的ASCII?我用getch()得到的都是224.#include conio.h#include iostreamint main(){int key ge
方向键的ASCII?我用getch()得到的都是224.
#include <conio.h>
#include <iostream>
int main()
{
int key = getch();
std::cout << std::endl << key << std::endl;
system("PAUSE");
return 0;
}
想得到方向键的ASCII,可惜,失败了。
[解决办法]
getch() 只能得到可打印字符
[解决办法]
- C/C++ code
#include "iostream"#include "conio.h"#include "stdlib.h"using namespace std;int main() { int key = getch(); if (key == 224) key = getch(); cout<<key<<endl; system("pause"); return 0; } 