logo - 刷刷题
下载APP
【简答题】

下面程序的功能是已知两个集合A、B,输出A、B两集合的交集。请在81题答题处完善程序。 例如:A={23,45,21,-9,4,-32,6,58,2},B={3,21,8,-32,23},则交集为{21,-32,23}。 #include void sort(int a[],int n) { int i,j,t; for(i=1;i { t=a[i]; j=i-1; while( 1 ) // 降序排序 { a[j+1]=a[j]; j--; } a[j+1]=t; } } int fine(int a[],int b[],int c[],int n,int m) { int i,t=0,p1,p2,pm; for(i=0;i { p1=0;p2=n-1; pm=(p1+p2)/2; while( 2 ) { if(b[i] else p2=pm-1; pm=(p1+p2)/2; } if(b[i]==a[pm]) 3 } return t; } main() {int a[9]={23,45,21,-9,4,-32,6,58,2},b[5]={3,21,8,-32,23}; int c[9]={0},i,n; 4 ; n=fine(a,b,c,9,5); for(i=0;i printf("%d",c[i]); }

题目标签:排序功能集合
举报
参考答案:
参考解析:
.
刷刷题刷刷变学霸
举一反三

【单选题】下列军事武器装备按发明时间先后排序,错误的是:

A.
弓箭、云梯、火药
B.
火炮、机枪、冲锋枪
C.
雷达、坦克、鱼雷
D.
航母、导弹、原子弹

【单选题】有如下事件过程:Private Sub Form_Load() Show Dim Arr() As Variant Arr = Array(1, 3, 5, 7, 9, 11, 13, 15) Call converse(Arr) For i = 0 To 7 Print arr(i); Next iEnd Sub 以上程序的功能是,通过调用Converse过程,将数组Arr中的元素逆序存放并输出...

A.
Private Sub converse(dim a() as Variant ) Dim T For i = LBound(A) To UBound(A) T = a(i) a(i) = a(UBound(A) - i) a(UBound(A) - i) = T Next i End Sub
B.
Private Sub converse(dim a() as Variant) Dim T Dim J As Integer J = (LBound(A) + UBound(A)) / 2 For i = LBound(A) To J T = a(i) a(i) = a(UBound(A) - i) a(UBound(A) - i) = T Next i End Sub
C.
Private Sub converse(a() As Variant) Dim T For i = LBound(A) To UBound(A) T = a(i) a(i) = a(UBound(A) - i) a(UBound(A) - i) = T Next i End Sub
D.
Private Sub converse(a() As Variant) Dim T Dim J As Integer J = Int((LBound(A) + UBound(A)) / 2) For i = LBound(A) To J T = a(i) a(i) = a(UBound(A) - i) a(UBound(A) - i) = T Next i End Sub

【单选题】最简单的交换排序方法是( )。

A.
快速排序
B.
选择排序
C.
堆排序
D.
冒泡排序

【多选题】监控平台有哪些功能?

A.
管理设备
B.
用户权限管理
C.
数据流管理
D.
录像存储管理
E.
与其它系统联动