What’s the difference between while(cin) and while(cin >> num)
Let’s look at these independently: This loop, intuitively, means “keep reading values from cin into x, and as long as a value can be read, continue looping.” As soon as a value is read that isn’t an int, or as soon as cin is closed, the loop terminates. This means the loop will only execute … Read more