This sort program is not working correctly, I was wondering what was wrong:

#include <iostream.h>

#include <stdlib.h>

int main()

{

int num[6];

int temp;

cout << "Enter 5 numbers to be sorted: ";

cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4];

for(int i=0; i<6; i++){

if(num[i] >= num[i+1]){

temp = num[i+1];

num[i+1] = num[i];

num[i] = temp;

}

}

for(int j=0; j<5; j++){

cout << num[j] << " ";

}

}

It sorts it somewhat, but it is not in the correct order(least to greatest). Thanks for the help.