really struggling

hi i have been racking my brain for hours and at the best of times i struggle with c++ but have not been able to do a task i was given and have got to my wits end i have two vectors that are manually imputed in a main.cpp file i need to create a vector.cpp file that takes these two vectors and makes sure they are the same length please any help would be great as i have no idea what i am doing thanks.
Are you serious?
return vec1.size()==vec2.size();
ok my bad i explained this really wrong i need to firslty have it so that it compares the length of the vectors and takes the abs of the difference and then alligns the two vectors after that. sorry for the explanation
And which part are you having trouble with? What do you have so far?

alligns the two vectors

What's that supposed to mean anyway?
i think it just means using the push_back function to place zeros at the end of the smaller vector? so they are of the same length and all i have soo far in terms of showing the difference between the two vectors is

int difference(vector<int> a, vector<int> b)

which is the first line of the difference vector (so nothing basically) i just really struggle with c++ and have no idea how to start it :S
Well, you start with one or two loops to align the vectors if you want to use push_back, otherwise just use resize and std::max. Then another loop to sum up the difference.
Hey Joey, you'll get a lot more help and understanding if you post some code that you are struggling with.

The struggle is part of the trouble.


It sounds like your assignment is to create your own vector class, and not use the STL vector class, correct?
Topic archived. No new replies allowed.