Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int i = 0; i < n;i++)
- {
- if(a[i] == 0)
- {
- static int c = i + 1;
- while(a[c] == 0)
- c++;
- if(c == n)
- break;
- if(a[c] != 0)
- {
- a[i] = a[c];
- a[c] = 0;
- }
- }
- }
- std::cout << "Выводим массив: " << std::endl;
- for(int i = 0; i < n;i++)
- std::cout << a[i] << " ";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement