Your main function must return an int value, so swap it from void to int.
To swap values in a void returning function you must pass the values by reference.
Your logic in the function is right otherwise.
Look at this tutorial it should answer your question. http://www.cplusplus.com/doc/tutorial/functions/
You made the changes kemotoe suggested, including the reference parameters. That's why. When you said "that wasn't the problem", it sounded like you weren't going to do that.