Note that cin.get() returns an integer, so if you use it as a if/loop condition you have to make sure to store the result as an int to be able to check if it returned a end of file value.
1 2 3 4 5
int ch;
while ((ch = cin.get()) != std::ios::eof())
{
// ...
}
cin.get(ch) works more similar to other read functions like >> and getline in that it returns a reference to the cin stream so that you can use it in a if/loop just as it is. I personally think this is often more convenient.