Hello to all, I need to know how to read the space bar as a character (or string) rather than as a separator, and I also need to know if the same can be done with the enter key. I am grateful for all contributions. :icon_mrgreen:

Recommended Answers

All 2 Replies

look up the various versions of getline(). There's one for C style strings and another for STL string objects.

Entering a keypress without pressing <Enter>

The following header must be added to the template:
#include <conio.h>

if one wants to continue keypresses until the ampersand (&) is pressed.

while((targetletter = getch()) != '&')

Hope this helps..would be a good idea to post your assignment. The above is not the answer to your question...but you should be able to formulate your answer from the above info.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.