URGENT! c++ "Multinacci" series

Pages: 12
honestly speaking, i don't understand your posts :(
i just made a program that's limited to 10 inputs. thanks for your help :))
You could:
(1) use an STL container to keep the numbers, say list<int>
(2) input the number of elements
(3) input the required number of elements, adding them to the container (..push_back)
(4) make an algorithm to sum the container. they are not overly hard (use ..for_each and a structure or class).
(5) append the new sum to the container (..push_back), and remove the first element from the container (..pop_front).
(6) do steps (4) and (5) 10 times.

Refer to:
http://www.cplusplus.com/reference/list/list/push_back/
http://www.cplusplus.com/reference/list/list/pop_front/
http://www.cplusplus.com/reference/algorithm/for_each/
No, he could not. The use of all C++ standard features is apparently not the topic of introductory programming courses. Besides, for step 4 there is already std::accumulate, and as already discussed, it is not even needed.

I did miss that bit that the number of outputs is a compile-time constant. @tntxtnt: Cool.


Really looking for the "expected" solution.
Hi! It seems thatour teacher really expects us to put a limit to the number of inputs from the user.

To all who willingly hepled me, thank you very much!
Topic archived. No new replies allowed.
Pages: 12