selection sort code using c++ and nested loops

//use header files syntax according to the compiler

#include <iostream.h>

#include<conio.h>
 
void main()
{

  int m, i, j, temp;
  int arr[8];
  cout<<"Enter Eight elements in the array";
  for(i=0;i<8;i++)
    cin>>arr[i];

    for (int i = 0; i <8; i++){
        for (int j = i+1; j<8; j++){
            if (arr[j] < arr[i]){
                int temp = arr[j];
                arr[j] = arr[i];
                arr[i] = temp;
            }
        }
    }
    for (int i = 0; i <8; i++){
        cout<<arr[i]<<" ";
    }cout<<endl;
}

//Syntax and explanation of for loop