Would it be possible to to use ungetchar() or ungetc() to return the character to the input stream after testing
for equal to 'x', and then use cin for the searchKey?

for example:



if...