well how would EOF work in this code?



#include <iostream.h>
int main()
{
char ch;
int count = 0;
cin.get(ch);
while (cin.fail() == false)
{
cout<<ch;
count++;
cin.get(ch);
}
cout<<"\n"<<count<<"characters read\n";
return 0;

}

how does taht get the output of

u type in anything u want
it repeats itself once
keeps this apttern up till u hit ctrl+z

how does that work