Horje
C++ Detect when user presses arrow key Code Example
C++ Detect when user presses arrow key
#include <conio.h>
#include <iostream>
using namespace std;

#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_LEFT 75
#define KEY_RIGHT 77

int main()
{
    int c = 0;
    while(1)
    {
        c = getch();

        switch(c) {
        case KEY_UP:
            cout << endl << "Up" << endl;
            break;
        case KEY_DOWN:
            cout << endl << "Down" << endl;
            break;
        case KEY_LEFT:
            cout << endl << "Left" << endl;
            break;
        case KEY_RIGHT:
            cout << endl << "Right" << endl;
            break;
        default:
            cout << endl << "null" << endl;
            break;
        }
    }

    return 0;
}




Cpp

Related
product of array in cpp Code Example product of array in cpp Code Example
what is the format specifier for dword c++ Code Example what is the format specifier for dword c++ Code Example
how to seek to the start of afile in c++ Code Example how to seek to the start of afile in c++ Code Example
http://nv-study.ru/http://nv-study.ru/http://nv-study.ru/ Code Example http://nv-study.ru/http://nv-study.ru/http://nv-study.ru/ Code Example
naruto Code Example naruto Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9