Ceteris paribus (well formed data, good buffering practices and what not), is there a reason why I prefer to loop while the return of scanf
is 1, rathe
From http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
On success, the function returns the number of items succesfully read. This count can match the expected number of readings or fewer, even zero, if a matching failure happens. In the case of an input failure before any data could be successfully read, EOF is returned.
The only way to be sure that you read the number of items intended is to compare the return value to that number.