解题思路:
注意事项:
参考代码:
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
int a[100], temp, k;
for (int i = 0; i < 9; i++)
{
cin >> a[i];
}
cin >> temp;
for (int i = 0; i < 9; i++)
{
if (a[i] < temp && temp < a[i + 1])
{
k = i;
break;
}
}
for (int i = 8; i > k; i--)
{
a[i + 1] = a[i];
}
a[k+1] = temp;
for (int i = 0; i < 10; i++)
cout << a[i] << endl;
}
0.0分
0 人评分