Guest User

Untitled

a guest
Mar 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int V[100];
  4. int n;
  5. int main()
  6. {
  7. cout<<"m=";cin>>n;
  8. for(int i=0;i<n+1;i=i+1)
  9. {
  10. cout<<"V["<<i+1<<"]=";
  11. cin>>V[1];}
  12. int gata=0;
  13. int copie=n;
  14. while(gata=0)
  15. {
  16. gata=1;
  17. for(int i=0; i<=n-2;i=i+1)
  18. if(V[i]>V[i+1])
  19. {swap(V[i];V[i+1]);
  20. gata=0;
  21. n=n-1;}
  22. n=copie;
  23. for(int i=0;i<=n-1;i=i+1)
  24. {
  25. cout<<V[i]<<" ";}
  26. }
  27. }
Add Comment
Please, Sign In to add comment