I don't think you should give me the whole answer like that. Just tell me this: will it work after I've made the change you mentioned to fill_multiples_v()? |
Sure, it's not an optimally way getting a whole solution of an exercise. I think the best way learning to programming is by having a skilled mentor on your side which you could ask if a problem arises. But if that is not feasable, the best way is, looking over good code examples. So I have here posted my solution. You could take that as a suggestion, and that I have posted the whole solution means not that you should code yours like my example. Feel free, looking at my suggestion only if you get sticked :-)
And no, at your code are some other errors then in fill_multiples_v().
For exercise 20: I would looping through the 'name'-vector for seaching the name, then taking its index number for getting the right score in the score-vector. Use a boolean flag, flagging if a match happend or not.
Ex. 21: Similar 20, traversing the score-vector in a for-loop for finding a matching number. Each time if such a match is found, remember the index-nr and print its name from the name-vector. Here helps also a flag for the right output.
Surely, with a map it would work better, I think. But I have still never worked with them until yet.
Feel free posting your exercise questions in the forum, I'm shure that they would also be very interesting for other students of c++.