I have some code and I wanted to use cin.eof() to stop my program from reading the input. I was thinking of doing:
char array[10]
while(!cin.eof())
{
for(int i = 0; i < 10; i++)
{
cin >> array[i];
}
}
And the code goes on. However, when I click '\n', my output is outputted. When i click cntrl + d, (on a UNIX terminal) the program performs the output again and then proceeds to end. How do I get it so that my program stops reading at a newline and prints my output when I type cntrl + d only once?
Thanks.