【用函数删除数组中特定数字】2022-11-23
缘由小白菜鸡提问!用函数删除数组中特定数字-编程语言-CSDN问答
int 用函数删除数组中特定数字(int* a, int n, int z)
{//缘由https://ask.csdn.net/questions/7843168int x = 0, y = 0;ks:if (y < n){if (a[y] == z)++x;else if (x)a[y - x] = a[y];else;++y;goto ks;}return n - x;
}int zs[]{1, 2, 3, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1}, x = 0, n = 15, y = 0;cin >> x;y = 用函数删除数组中特定数字(zs, n, x); x = 0;c:if (x < y){ cout << zs[x] << " ", ++x; goto c; }