how to use wasd c 2b 2b

Solutions on MaxInterview for how to use wasd c 2b 2b by the best coders in the world

showing results for - "how to use wasd c 2b 2b"
Jazmín
24 Jun 2019
1#include <iostream>
2#include <conio.h>
3using namespace std;
4int main()
5{
6    char ch=0;
7    cout << "Press Q to quit\n";
8    do
9    {
10        ch = getch();
11
12        switch(ch)
13        {
14            case 'W':
15            case 'w':
16                cout << "W was pressed \n";
17                break;
18            case 'A':
19            case 'a':
20                cout << "A was pressed \n";
21                break;
22            case 's':
23            case 'S':
24                cout << "S was pressed \n";
25                break;
26            case 'D':
27            case 'd':
28                cout << "D was pressed \n";
29                break;
30
31        }
32
33    }while (ch != 'Q' && ch!='q');
34}
35