I was assigned to write a program that uses parallel vectors and functions which fills each of them with 500 random numbers between 1 and 100. The program is supposed to pass both vectors to a function which will return an integer indicating a count of how many times both vectors had even numbers in the same location. So if vetor01 [0] contained 4 and vector02 [0] contained 12, you would add one to count. If vector01 [1] contained 3 and vector02 [1] contained 4, you would not add one to count
example of how it should look like: The vectors contain 128 cells where both values are even.
what I have so far, although I don't think I'm on the right track
I'm not sure I understand @gunnerfunner,
I haven't been taught to use #include <algorithm> or #include <chrono>
also why is #include<fstream> being used if there isn't a file being read or outputted?
why is #include<fstream> being used if there isn't a file being read or outputted?
good spot, it's a carry-over from something I was working on when I picked up your post, there's <iomanip> in there as well that's not required.
Now, to get back to your issue, if you cant use those libraries suggested, it gets a bit tricky because as I'd posted recently trying to fill 2 containers with random numbers in the same program seems to fill both with the same set of random numbers each time! http://www.cplusplus.com/forum/beginner/212961/#msg994714
So, unless someone comes up with a neater solution, you could have one std::vector or std::list of 1000 and then split / splice the container into 500 elements each and finally run the test vis-a-vis line 31 of my earlier post (details for splicing std::list in above thread):