Recently I bought C++ Primer 5th Edition and this sh*t f**k book, which suprisingly provides questions...WITHOUT answers! So progressing through chapters unsure if I am doing the exercises correctly. I have gotten to an exercise asking me to:
"Write a recursive function to print the contents of a vector."
I have searched the web for days but nothing is exactly what my question is...so I really need help on this one please.
int temp[] = {0,1,2,3,4,5,6,7,8,9};
vector<int>vec (begin(temp), end(temp));
int recursive (vector<int> val)
{
if (val.begin() != val.end())
return recursive(val - 1) * val;
return 1;
}
int main()
{
recursive(vec);
}

New Topic/Question
Reply



MultiQuote





|