Image

Imageandrogy8 wrote in Imagecpp

Basic C++ question

I'm trying to write a program using console-based C++ that looks at a bunch of user-entered numbers and orders them in a list using a specified algorithm.
The ordering part I can do. The part I'm having trouble with is the entry part. The instructor said that the list of the users' numbers should be separated by the Enter key, so the entered list would look something like:
45
24
28
100
121

Also there is an unknown number of elements being entered, so a while loop is needed.
All I want to through is loop through the numbers that are entered. But I'm getting stuck on the how-to-process the user input, because cin doesn't work (it stops at whitespace), and I'm not sure what the conditional check is to use cin.getline. (I only want to get the next line if it exists).

I think the important part of this assignment is supposed to be the ordering algorithm, not the data entry, so I don't feel bad asking for help on this part.
Thanks for any help in advance.