## Sorting problems

HI I just started learning c++. Below is the bubble_sorting program I wrote. Complied no error under eclipse(Ubuntu). But the result is not right.

What is happening is, no matter what input numbers I provided, after sorting, the smallest number would be set to zero. Please, can anyone point out where did I do wrong. Many thanks in advance!

//start of the program
//Bubble_sorting

#include <iostream>
using namespace std;

void BubbleSort(int *list,int len)
{
int i,j,temp;
for(i=0;i<len;i++)
for(j=0;j<len-i;j++)
{
if(list[j]>list[j+1])
{
temp=list[j];
list[j]=list[j+1];
list[j+1]=temp;
}
}
}

int main ()
{
int len;
cout<<"input the number of int to sort"<<endl;
cin>>len;
int *p = new int[len];

cout<<"Input ten number:";
for(int i=0;i<len;i++)
cin>>p[i];
cout<<endl;

cout<<"Before sorting: ";
for(int i=0;i<len;i++)
cout<<p[i]<<" ";
cout<<endl;

BubbleSort(p,len);
cout<<"After sorting: ";
for(int i=0;i<len;i++)
cout<<p[i]<<" ";

cout<<endl;
cout<<p[0]<<endl;
cout<<endl;

delete[] p;
p = NULL;
return 0;
}