Sorry, what is it you are trying to do? As far as I know, for what you want, cout << "ascii character here"; works just fine.
The code you are posting basically is a test for if a key is being pressed, and sets the int values of x and y according to what is being pressed. It is occurring in an ongoing loop, thus constantly testing for these states.