Produces this as an error:Code:#include <iostream>
using namespace std;
int main()
{
int swapCount = 0;
int i, j;
const int arraySize = 11;
int array [arraySize] = (10,9,22,1,3,6,9,2,13,18,20);
for(i < arraySize-1; i++;)
{
for(j < arraySize-1; j++;)
{
if(array[j-1] > array[j])
{
int tempInt = array[j-1];
array[j-1] = array[j];
array[j] = tempInt;
}
}
}
}
bubblesort.cpp: In function 'int main()':
bubblesort.cpp:10: error: array must be initialized with a brace-enclosed initializer
Also i need to add a working counter into this.
TL;DR: Need help fixing the error and adding a working counter in to count how many swaps it does.
Thanks in advanced for any help!