Hi.
I'm writing a program that includes a Y/N choice (yes/no) and reading a text WITH SPACES directly after the choice is made.
#include <stdio.h>
char choice = N;
string str;
while (choice == N)
{
...
If you want to continue type in Y, if not - N.
choice = getch()
}
getline (cin, str)
So this is the part I have problems with...
First of all getch () should return the first character the user will type in right? Even if not exactly this, I think that when my program comes to this function it says there's an error because: "Drawing operation was attempted when there was no current window". Could someone explain me this weird error and where does it come from?
Now comes the easier part... when I skipped the getch by putting getchar instead, I needed to press enter, and I don't want that. Either way it looks like str leaves with no data because getline already read the enter. Where does the second enter come from and how to fix it?
Please give me a quick answer at least on one of the two problems.
Thank You.