Guest User

Untitled

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