I am new to programming and am following a book about C++ programming. When I type the following code and click "Debug" I get a black screen and nothing happens. There is a printf function so I assume something is supposed to happen. Please help.
#include <stdio.h>
int main()
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF) {
if (c == '\n')
++nl;
}
printf("%d\n",nl);
Thank you for the help. Still there is a problem. When I click Ctrl+Z, the program exits out. If i add #include <conio.h> and a _getch(); at the end, then the programs runs fine, why is that?