Funksionin e readkey() e kryen getch() ose getche(). E dyta e shfaq gërmën në ekran. Funksionin keypressed() e kryen kbhit().
Ja kodi që përdor këto tre funksione:
Kodi PHP:
#include <iostream>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Shyp nje buton (pa enter)" << endl;
char tast = getche();
while (true) {
cout << endl << "A deshiron te mbyllesh programin? P/J" << endl;
tast = getch();
if (tast == 'P' || tast == 'p') {
cout << "Po" << endl;
break;
} else {
cout << "Jo" << endl;
}
}
cout << endl << "Shtyp nje buton per te mbyllur programin." << endl;
while (!kbhit()) { }
return EXIT_SUCCESS;
}
Krijoni Kontakt