It is necessary to store in a vector a sequence of numbers, but pressing the ENTER only at the end of the line.
For example:
ENTRADA: 10 20 30 15 50 <ENTER>
Vetor[] = {10, 20, 30, 15, 50}
It is necessary to store in a vector a sequence of numbers, but pressing the ENTER only at the end of the line.
For example:
ENTRADA: 10 20 30 15 50 <ENTER>
Vetor[] = {10, 20, 30, 15, 50}
If you are using c ++ you can use a vector
which is simple so you can add numbers as you read them.
As for reading itself can do in many ways. One of the most straightforward is with stringstream
. In this scenario the reading can be all done from cin
at once only with% href="