<le*******@gmail.com> wrote in message

news:11**********************@i39g2000cwa.googlegr oups.com...

Here is a little code I wrote to add the numbers input by the

user.....I was wondering if its possible to have the same functionality

without using dynamic arrays.....just curious.....

Let me restate the problem.

You want to

1) Read a sequence of numbers of unknown length.

2) Print all the numbers in the order in which they were read.

3) Print their sum.

Obviously, in order be able to do (1) and then (2), you need enough memory

to store all of the numbers. A dynamic array is one way of obtaining that

memory. I can think of two other ways of doing so, one of which does not

involve any explicit dynamic memory allocation at all. However, I think

this may be a homework assignment, so I am reluctant to explain what they

are.