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