Is it possible this is the same problem you had last time?
Remember that you have to do something to tell the program that there are no more numbers to input.
You can either enter something non-numeric (like abc) or you can signal the end-of-file condition (Ctrl-Z on windows, Ctrl-D on linux).
The 100 part is missing when I go to press ctrl + F5. This is a program in a book called C++ Primer by Stanly Lippman. Another question: if the above program is hard for me to understand--in its entirety, do I have any business learning how to program?
Why would you want it to run like that?
You're not making any sense!
If you enter 1 2 3 4 it should print
1 occurs 1 times
2 occurs 1 times
3 occurs 1 times
4 occurs 1 times
Anyway, about the missing "100 occurs 3 times" line.
Did you do what I told you to do (and what you were told in your last thread)?
The program isn't going to know you're done entering numbers until you tell it, either by signalling end-of-file or entering something non-numeric.
I meant the second part:
42 occurs 5 times
55 occurs 2 times
62 occurs 1 times
100 occurs 3 times
I want it like that because thats what the book says should come out! I already tried what you said and it worked but I want what the book says should come out, Im using visual studio and ctrl + F5'ing. Would you say then that the book is wrong? Also could you answer my non-technical question: " if the above program is hard for me to understand--in its entirety, do I have any business learning how to program? "
I'm confused. Do you want it to print "X occurs Y times" interlaced with further user input, or do you only want it to print at the end, after all user input?
If it's the latter, this can definitely be hard for a beginner if you don't understand the concept of a map, because you need to save the results somehow, and so you either need an array of {number, num. occurrences} pairs, or a more efficient container like a tree.
If the above program is hard for me to understand--in its entirety, do I have any business learning how to program?
A beginner can't be expected to understand everything about this program.
Programming is intrinsically challenging. If you enjoy this, find it rewarding, relaxing, entertaining, engaging, or want to learn for any reason, yes, you have business learning to program.