it always displays going up no matter what key is pressed can anyone tell me why?
edit: the keys i want to be used are w a s d
Code:#include <iostream> #include <conio.h> using namespace std; int main () { /* variables */ int key; /* variables end */ top: if (kbhit()) { key = _getch(); if (key = 119) { cout<<"Going Up \n"; } else if (key = 115) { cout<<"Going down \n"; } else if (key = 97) { cout<<"Going left \n"; } else if (key = 100) { cout<<"Going right \n"; } } goto top; return 0; }