void bubbleSort(int aray[],int length)//Bubble sort function { int i,j; for(i=0;i<length;i++) { for(j=0;j<i;j++) { if(aray[i]>aray[j]) { int temp=aray[i]; //swap
aray[i]=aray[j]; aray[j]=temp; }
} } } int _tmain(int argc, _TCHAR* argv[]) { int n; int array1[100]; cout<<"Enter the number of elements : "; cin>>n; for(int i=0;i<n;i++){ cout<<"Enter the "<<i+1<<" element : "; cin>>array1[i]; } bubbleSort(array1,n); for(int i=0;i<n;i++){ cout<<array1[i]<<" "; } cout<<" Press any key to exit...."; getch();
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment