Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void insertion(int array[],int n);
  4.  
  5. void insertion(int array[],int n)
  6. {
  7. for(int i=0; i<n; i++)
  8. {
  9. int x=array[i];
  10. int j=i-1;
  11. while(j>=0 && array[j]>x)
  12. {
  13. array[j+1]=array[j];
  14. j--;
  15. }
  16. array[j+1]=x;
  17. }
  18. }
  19.  
  20. int mani()
  21. {
  22. cout<<"how many number store in your array? ";
  23. int n;
  24. cin>>n;
  25. cout<<endl;
  26. int array[n];
  27. for(int i=0; i<n; i++)
  28. {
  29. cin>>array[i];
  30. }
  31. void insertion(int array,int n);
  32. for(int i=0; i<n; i++)
  33. {
  34. cout<<array[i]<<" ";
  35. }
  36. cout<<endl;
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement