Hi, I am going through a book about C++ at the moment. I understand the concept in this question about if else. One of the things it wants me to do is first put the code in my computer exactly and make sure it runs right before moving on. I've looked over it 3+ times and don't see anything different from the book.
It is supposed to take an input of numbers "33 33 42 42 45" then shoot out "X occurs Y times". It does this for 3 of them max, but any more different numbers then three it just acts like it isn't there.
I'm using Microsoft Visual Studio if that makes a difference.
The only time lines 12 and 13 are executed is when you enter a value that is different from the last value entered. You don't do that for the the last set of values.
From the picture of your input you don't do anything that would cause std::cin >> val to not succeed, so the while loop is never terminated, and lines 18 and 19 are never reached. You might try entering a letter to terminate the input.