本文介绍了kbhit()或getch()的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,
我遇到问题 kbhit()
和 getch()
功能。
Hey,
I am having problem with kbhit()
and getch()
function.
//word = "Hello";
//Funtion is working fine but when I press a key it doesnot enter if(kbhit()) loop.
//Moreover, I tried _getch() next to "if" loop statement but _getch() is also not working :(
void Game::Print_LetterBox(int x,int y,char* word)
{
int size = strlen(word);
char key;
if(_kbhit())
{
key = _getch();
}
for(int i=0;i<size;i++)
{
Letter_Box( word[i],x + i*34,y,"purple");
for(int j=0;j<size;j++)
{
if(word[j] == key)
Letter_Box( word[i],x+i*34,y,"red");
}
}
Animated_Character( x + size*34, 540 , 5);
}
任何帮助!!
Any help!!
推荐答案
这篇关于kbhit()或getch()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!