Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int V[100];
- int n;
- int main ()
- {
- cout<<"n=";cin>>n;
- for(int i=0;i<=n-1;i=i+1)
- {
- cout<<"V["<<i+1<<"]=";
- cin>>V[i];}
- int gata=0;int copie=n;
- while(gata==0)
- {gata=1;
- for(int i=0;i<=n-2;i=i+1)
- {
- if(V[i]>V[i+1])
- {swap(V[i],V[i+1]);
- gata=0;
- }
- }
- n=n-1;}
- n=copie;
- for(int i=0;i<=n-1;i=i+1)
- {cout<<V[i]<<" ";
- }}
Add Comment
Please, Sign In to add comment