#include <iostream>
using namespace std;
int main() {
int a[10] = { 1,30,50,200,900 };
int i, data, n = 5, data_i;
cout << "Please input a integer:";
cin >> data;
for (i = 0;i < n;i++) {
if (data > a[i])
data_i = i + 1;//获取data应有的下标
else
data_i = 0;
}
for (i = n - 1;i >= data_i;i--)
a[i + 1] = a[i];//把data后的数均向后移一位
a[data_i] = data;//插入data
for (i = 0;i <= n;i++)
cout << a[i] << " ";
return 0;
}