apstring DisplayInputXY (int nX, int nY) { setcolor(WHITE); settextjustify(1,0); //set to horizontal center justification apstring sString; char cInput; do { cInput=getch(); setcolor(BLACK); //set to black to erase old output outtextxy(nX,nY,sString.c_str()); if(cInput!=13&&cInput!=8) //if not return or backspace sString+=cInput; //add character to string else if (cInput==8) //if backspace sString=sString.substr(0,sString.length()-1); //erase last character setcolor(WHITE); outtextxy(nX,nY,sString.c_str()); }while(cInput!=13); //stop loop with enter return sString; }