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

下列给定程序中,函数fun()的功能是:用冒泡法对6个字符串按由小到大的顺序进行排序。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.
试题程序:
include <conio.h>
include <stdio.h>
define MAXLINE 20
/*************found**************/
fun(char *pstr[6])
{int i, j;
char *p;
for(i=0;i<5;i++)
{for(j=i+l;j<6;j++)
/*************found**************/
{ if(strcmp(*(pstr+i),pstr+j)>0)
{
p=*(pstr+i);
/*************found**************/
* (pstr+i) -pstr+j;
* (pstr+j)=p;
}
}
}
}
main ( )
{ int i;
char *pstr[6],str[6][MAXLINE];
clrscr();
for(i=0;i<6;i++) pstr[i]=str[i];
printf('/nEnter 6 string(1 string at each
line):/n ');
for(i=0;i<6;i++) scanf('%s',pstr[i]);
fun(pstr);
printf('The strings after sorting:/n ');
for(i=0;i<6;i++) printf('%s/n ',pstr[i]);
}

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

【单选题】有如下事件过程: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.
与其它系统联动