PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Line 1: That's not how to declare arguments.
You have many undefined variables.
Line 4: res is an array. L8: res is redeclared as a simple int. You can't do that in the same scope.
Line 8: finder is undefined.
Line 15,17: You need the <utility> header in order to use std::swap. l is undefined.
(<algorithm> header if you're using C++98.)