I understand how to manipulate a vector within a function, but I am confused on how to return that vector. I am quite new to C++ and would appreciate any guidance. I am currently using these libraries within this function :
#include<iostream>
#include<vector>
#include<string>
using std::cin; using std::cout; using std::endl;
using std::string; using std::vector;
I am unsure if I am already missing something which is causing many errors during compiling, but this is what I have initialized my program with. I seem to have an absolutely massive amount of errors when compiling. I have noticed a lot of errors with a focus on ostream which could be the source of my problems. Here is the code I'd like to run. This is a dumbed down version of what I'd like to do within the function, but I was baffled at the massive amount of errors with such little code which I am assuming is derived from trying to return a vector. Thank you for any help you can provide me with.
vector<long> function(long small,long big){
vector<long> vec;
vec.push_back(big);
vec.push_back(small);
return vec;
}
int main(){
cout << function(1, 2);
}