diff --git a/programs/C++/sort_integer_array.cpp b/programs/C++/sort_integer_array.cpp new file mode 100644 index 0000000..6eab30c --- /dev/null +++ b/programs/C++/sort_integer_array.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() +{ + int n; + cout<<"Enter the number of elements: "; + cin>>n; + int a[n]; + int temp; + for(int i=0;i>a[i]; + for(int i=0;ia[j]) + { + temp=a[j-1]; + a[j-1]=a[j]; + a[j]=temp; + } + } + for(int i=0;i +int main() +{ + int n,i,j,temp; + printf("Enter the number of elements: "); + scanf("%d",&n); + int a[n]; + for(i=0;ia[j]) + { + temp=a[j-1]; + a[j-1]=a[j]; + a[j]=temp; + } + } + for(i=0;iarr[j]): + temp=arr[i] + arr[i]=arr[j] + arr[j]=temp + return arr +print("sorted array: ") +print(sorted(arr))