Ok I see how that could be. I cannot run the program without initializing 'i' first though. How do I go about tackling the problem in the above code, correctly?
could I take that same methodology and produce the array count identifier (not sure of the terminology) via the times the user has entered 'y' or (yes)? I want the array to be dynamic in terms of however many times the user decides to hit 'y' and continue, it will allow for it and make the appropriate accommodations in the array
I'll give you what I think/know. I'm not amazing at C++. lol.
Classes. Good for recreating 'objects', encapsulating the same code. i.e. If you had a lot of players in the same game of what ever, you don't want to have to code the same 'human' over and over. You just create an object of that class.
Structures. I kind of see these the same as classes. Just... less involved.
Enum. I use these quite a bit. Say, if you have a facing direction, up, left, down and right. You could create these as enum's. Then when you pass these to a function, instead of having a switch statement with 0, 1, 2 and 3, you can use explicit naming. Saves looking through code etc to find out what '3' is...
Typedef. So you want an iterator for a vector. You'd type something like: std::vector< songs >::iterator it;
Every time you want a new iterator, for a different loop.
By typeing: typedef std::vector< songs>::iterator songsIt;
When you need a new iterator, all you now need to type is: songsIt;
Because you typedef'ed it as songsIT, songsIt is essentially typing the whole thing out.
Lines 17 & 22. You push_back() twice! You'll edit the first one, on first run of the loop. With index 2 empty. Then on second run, you'll edit index 2, when, again, you've just push_back()'ed another one!
push_back() once, just before the editing. Or you'll have empty struct's in the vector.
On a side note. My above post! I think that's my biggest 'word'(not code) reply ever! LOL
Edit:
Also, if anyone disagrees with anything in my above post. I'd like to know! I'm here to learn too! (:
Classes - Used for grouping concepts of code into a reusable block, which you can create multiple instances of as objects.
Structures - Less involved..
Enum - Creates aliases that make code easier to read
Typedef - Allows you to define your own iterators and things of that nature? So the predefined reverse_iterator (in conjuction with rend and rbegin) must be a form of a typedef, correct?