Vectors

Hi, I just started learning c++ and I was doing fine until we hit vectors and arrays. If anyone could help me through this program and explain I would be really appreciate it!

1. Create a vector (snow) that will hold integers which represent snowfall amounts for several months.
2. Ask the user how many months they would like to record. (input 5 when the program runs)
3. Create a loop that will ask for the “Snowfall amount for month # 1: “, etc
4. Fill the vector with the amounts input by the user.
5. Keep track of the grand total of the amounts in the fill loop.
6. In a separate loop, print the snowfall amounts back out on the screen, following the same
format as in step 3.
7. Label and report the grand total after all input.
Grand total: .. inches of snow
8. Using the size function, label and report the number of months recorded.

There are ... months recorded.
9. Write the code that will remove the last snowfall amount from the vector.11. Label and report the number of months recorded.
There are now … months recorded.
10. Clear all elements from the vector.
11. Label and report the number of months recorded.
After clearing all data, there are …months recorded
If anyone could help me through this program and explain I would be really appreciate it!

If you could post something showing some effort other than "I posted Help!! on these forums!" you would be more likely to get a helpful response.
.
Last edited on
@SakurasouBusters

Couldn't you just help the OP where he/she asked instead of asking him to send you private messages? You'll be able to help a lot more people.
Please be wary of people asking you to PM them. This forum has trolls who maliciously give bad advice to beginners, and they try to do this in private because they know they'll be called out on it in public.

Ask yourself: Why would it benefit you to have the conversation in private with one person, when you could get the collective advice of the experts here by holding it in public?
@MikeyBoy
I told him to be considerate with his decision whether or not he sends me a private message. I am not forcing him though.

And I am a programmer, not an 'useless troll'.
And I am a programmer, not an 'useless troll'.

We'll judge that from your behaviour, rather than from your protestations.

Behave like someone who's not a troll, and we'll stop treating you like one. You can start any time you like.
Thanks for the responses. I will read more up on vectors and give it a try and respost soon. Arrays and pointers are hell for me right now.
closed account (48T7M4Gy)
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/doc/tutorial/pointers/


http://www.cplusplus.com/reference/vector/vector/operator[]/
Last edited on
Topic archived. No new replies allowed.