Guest User

Untitled

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