STL and Vectors
| bluegray (29) | |||
| its been about a year and a half since the last time i did any real c++ programing and could really use some help getting the ball rolling again! I need to fill the two vector's with random numbers with s1 and s2 being the seed values. Should i use the vector class methods to fill them like push_back or some other way. I am not looking for any exact code just some ideas or pseudo code this is where i am so far ... no where lol #include <vector> #include <iostream> #include <cstdlib> #include <ctime> #include "/home/turing/onyuksel/courses/340/common/340.h" //header file using namespace std; void Vecs(vector<int>& v1, vector<int>& v2, int s1, int s2) { } | |||
| firedraco (657) | |||
| Yes, you should use vector.push_back() to insert the #s...also, you shouldn't want a seed value, just srand(time()); at the beginning of your entire program. Then just pass the vectors like you are, and push_back() the random numbers you generate. | |||
This topic is archived - New replies not allowed.
