Another bubble sort curiosity ?
How can i Modify the sort to check at the end of each pass if any swaps have been
made. If none have been made, then the data must already be in the proper order, so the program should terminate. If swaps have been made, then at least one more pass is needed.

I started with amountOfSwaps but i got last after that part...		

        int modifiedBubbleSortArray(int array[])
		{
			for(int i=0;i<10;i++)
			{
				for(int j=0;j<i-1;j++)
				{
					if(array[i]>array[j])
					{
						swap(array[i], array[j]);
						amountOfSwaps += 1;
					}
				}
			}

		printArray(array);
		return amountOfSwaps;

		}

		void swap(int & value1, int & value2)
		{
			int temp=value1; 
			value1=value2;
			value2=temp;
		}

Another bubble sort curiosity ?
===

How can i Modify the sort to check at the end of each pass if any swaps have been
made. If none have been made, then the data must already be in the proper order, so the program should terminate. If swaps have been made, then at least one more pass is needed.

I started with amountOfSwaps but i got last after that part...		

        int modifiedBubbleSortArray(int array[])
		{
			for(int i=0;i<10;i++)
			{
				for(int j=0;j<i-1;j++)
				{
					if(array[i]>array[j])
					{
						swap(array[i], array[j]);
						amountOfSwaps += 1;
					}
				}
			}

		printArray(array);
		return amountOfSwaps;

		}

		void swap(int & value1, int & value2)
		{
			int temp=value1; 
			value1=value2;
			value2=temp;
		}
