#include <iostream>
using namespace std;
int main(){
int S, T;
//给定线性表数组a
int a[10] = {2, 9, 9, 1, 6, 5, 7, 2, 1, 8};
//输出数组a
for (int i = 0; i < 10; i++){
cout << a[i] << ' ';
}
cout << endl << "输入S和T:" << endl;
cin >> S >> T;
//如果S > T,交换S和T的值(默认S <= T)
if (S > T){
int temp = S;
S = T;
T = S;
}
//输出处理过后的数组a
cout << "输出结果" << endl;
for (int i = 0; i < 10; i++){
//如果这个数小于等于S或者大于等于T(表示不用删除),就输出
if (a[i] <= S || a[i] >= T){
cout << a[i] << ' ';
}
}
return 0;
}
#include using namespace std;int main(){int S, T;//给定线性表数组aint a[10] = {2, 9, 9, 1, 6, 5, 7, 2, 1, 8};//输出数组afor (int i = 0; i < 10; i++){cout << a[i] << ' ';}cout << endl << "输入S和T:" << endl;cin >> S >> T;//如果S > T,交换S和T的值(默认S <= T)if (S > T){int temp = S;S = T;T = S;}//输出处理过后的数组acout << "输出结果" << endl;for (int i = 0; i < 10; i++){//如果这个数小于等于S或者大于等于T(表示不用删除),就输出if (a[i] <= S || a[i] >= T){cout << a[i] << ' ';}}return 0;}