void swap(int &x, int &y, int t = 0) {t = x, x = y, y = t;}
void bubbleSort(int arr[], int size)
{
int i, j;
for(i = 0; i < size; i++)
for(j = 0; j < size - 1; j++)
if(arr[j] > arr[j+1]) swap(arr[j], arr[j+1]);
}
The original function is to a function that performs a snap for the numbers array
Presumably, you mean the original function is a function that performs a swap for the numbers array. Such a function is convenient to have in order to facilitate the creation of a sorting function (such as one that implements the bubblesort algorithm.)
Boxbird is right in that the original function is broken. I would verify that you've reproduced it correctly (because I'm fairly certain you have not.)
I was going on what my teacher gaves us . He was like put in Visual Studio and it should run but I was thinking something isnt right and it is missing some things