【数据插入最大值后】2022-2-2
缘由请问下面的题我哪里错了?-编程语言-CSDN问答
void 数据插入最大值后()
{//缘由https://ask.csdn.net/questions/7638490?spm=1005.2025.3001.5141int n = 0, a[101]{}, x = 0, d = 0;std::cin >> n;//5 7 2 3 4 5 9while (x<n)std::cin >> a[x], (a[d]<a[x] ? d = x : 0), ++x;while (d + 1 < x)a[x] = a[x - 1], --x;//算交换(a[x - 1], a[x]), --x;std::cin >> a[x]; x = 0;while (x <= n)std::cout << a[x] << " ", ++x;
}