Hey guys,
Just wondering how I check for the space bar input...since my program doesn't seem to want to know when I hit the space bar..... It just outputs a space on the konsole window and then hitting enter makes a new line...
cheers John
Hey guys,
Just wondering how I check for the space bar input...since my program doesn't seem to want to know when I hit the space bar..... It just outputs a space on the konsole window and then hitting enter makes a new line...
cheers John
>It just outputs a space on the konsole window and then hitting enter makes a new line...
That's correct behavior. Input in C++ is line oriented. If you want to just hit a space and have it be recognized immediately, you need to use a non-standard function such as getch to take raw input.
can u send the code or would u be more spcific about ur answer
char ch;
ch = getchar();
if(ch==' ')
{
-- do something with ch --
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.