how ro return 2 values x and y from function to main? then to add these values to the a[x], and a[y]. it means to add x and y from function to the array
You could use pointer arguments, too. Then it will be obvious to the users of the function that the values may be modified (noticeable from the & in the calls).
Although less common, you could also return a std::pair or a boost::tuple. It all depends on how you want your code to be.