I have made this bubble sort program. And i want to know if I had made any mistake.(Although its working fine. Just curious that i have used bubble sort algo incorrectly).

Tips and help appreciated

#include <iostream> #include <conio.h> #include <iomanip> using namespace std; int main() { const int size = 16; int ar[size]={90,80,70,65,54,44,32,505,100,33,-12,-1,0,-900,88,75}; unsigned int temp = 0; // to swap array values cout << "Unsorted Array: " << endl; for(int j=0; j <size;j++) { cout << setw(6) << ar[j]; } cout << endl; for(int s=0; s<size-1;s++) { for(int k=0;k<size;k++) { if(k == (size-1)) { break; } else if(ar[k] > ar[k+1]) { temp = ar[k]; ar[k] = ar[k+1]; ar[k+1] = temp; } } } cout << "Sorted array is: " << endl; for (int m=0;m<size;m++) { cout << setw(6) << ar[m]; } _getche(); }