#include <iostream>
using namespace std;
void func(int* p, int n);
int main() {
int arr[6] = { 0 };
for (int i = 0; i < 6; i++) {
cin >> arr[i];
}
func(arr, 6);
for (int i = 0; i < 6; i++) {
if (i == 5) {
cout << arr[i] << endl;
}
else {
cout << arr[i] << " ";
}
}
return 0;
}
void func(int* p, int n) {
int *t1{p};
for (int i{0}; i < n; i++) {
if (p[i] == 0 && *t1 != 0) {
t1 = &p[i];
} else {
if (*t1 == 0 && *(p+i) != 0 && t1 != p+i) {
int temp{*t1};
*t1 = *(p+i);
*(p+i) = temp;
t1++;
}
}
}
}

京公网安备 11010502036488号