运用朗格系数法进行投资估算,其计算基数是()。
A.设备费
B.设备安装费
C.建筑工程费
D.建筑安装工程费
第1题
阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明]
完成以下中序线索化二叉树的算法。
[函数]
Typedef int datatype;
Typedef struct node {
Int ltag, rtag;
Datatype data;
*lchild,* rchild;
}bithptr;
bithptr pre;
void inthread (p );
{if
{inthread (p->lchild );
if (p->lchild==unll ) (1);
if (P->RCHILD=NULL) p->rtag=1;
if (2)
{if (3) pre->rchild=p;
if (p->1tag==1 )(4);
}
INTHREAD (P->RCHILD );
(5);
}
}
第2题
阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明1]
函数int function(int a)的功能是判断指定的正整数是否为素数,若是,返回1,否则返回0。
[C函数1]
int function(int a)
{ int yes,i;
i=2;yes=1;
while(i<=a/2 && (1) ){
if((2) ) yes=0;
i++;
}
return yes;
}
[说明2]
函数int deleteARR(int*arr,intn)的功能是指定的有序数组压缩成各元素互不相同的有序数组,即相同数只保留一个,多余的被删除。函数返回值是互不相同的元素个数。
[C函数2]
int deleteARR(int*arr,int n)
{ int k,j;
k=0;j=1;
while(j<n){
if((3) )
(4)=arr[j];
j++;
}
return (5);
}
第3题
阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明]
已知r[1...n]是n个记录的递增有序表,用折半查找法查找关键字为k的记录。若查找失败,则输出“failure",函数返回值为0;否则输出“success”,函数返回值为该记录的序号值。
[C函数]
int binary search(struct recordtype r[],int n,keytype k)
{ intmid,low=1,hig=n;
while(low<=hig){
mid=(1);
if(k<r[mid].key) (2);
else if(k==r[mid].key){
printf("succesS\n");
(3);
}
else (4);
}
printf("failure\n");
(5);
}
第4题
阅读下列函数说明和C代码,将应填入(n)处的字句写在对应栏内。
【说明】
函数QuickSort是在一维数组A[n]上进行快速排序的递归算法。
【函数】
void QuickSort(int A[ ],int s,int t)
{ int i=s,j=t+1,temp;
int x=A[s];
do{
do i ++ ;while (1);
do j -- ;while(A[j]>x);
if(i<j){temp=A[i];(2);(3);}
}while(i<j);
A[a] =A[j];A[j] =x;
if(s<i-1) (4);
if(j+1<t) (5);
}
第5题
阅读下列函数说明和C函数,将应填入(n)处的字句写在对应栏内。
[函数2.1说明]
Fibonacci数列中头两个数均为1,从第三个数开始,每个数等于前两个数之和。下述程序计算Fibonacci数列中前15个数,并以每行5个数的格式输出。
[函数2.1]
include <stdio.h>
main()
{ int i,f,f1=1,f2=1;
printf("%5d%5d",f1,f2);
for(i=3;i<=15;i++){
f=(1);
printf("%5d",f);
if((2)= =0) printf("\n");
f1=12;
(3);
}
}
[函数2.2说明]
函数fun(char *str1,char *str2)的功能是将字符串str2拼接到str1之后。
[函数2.2]
fun(char *str1,char *str2)
{ int i,j;
for(i=0;str1[i]!='\0';i++);
for(j=0;str2[j]!='\0';j++) (4);
(5);
}
第6题
●试题四
阅读下列函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。
【说明】
函数QuickSort是在一维数组A[n]上进行快速排序的递归算法。
【函数】
void QuickSort(int A[],int s,int t)
{int i=s,j=t+1,temp;
int x=A[s];
do{
do i++;while (1) ;
do j--;while(A[j]>x);
if(i<j){temp=A[i]; (2) ; (3) ;}
}while(i<j);
A[a]=A[j];A[j]=x;
if(s<i-1) (4) ;
if(j+1<t) (5) ;
}
第7题
阅读以下函数说明和C语言函数,将应填入(n)的字句写在答题纸的对应栏内。
[说明1]
函数int fun1(int m, int n)的功能是:计算并返回正整数m和n的最大公约数。
[函数1]
int fun1(int m, int n)
{
while ((1)) {
if (m>n) m=m-n;
else n=n-m;
}
(2);
}
[说明2]
函数long fun2(char*str)的功能是:自左至右顺序取出非空字符串str中的数字字符形成一个十进制整数(最多8位)。
例如,若字符串str的值为“f3g8d5.ji2e3p12fkp”,则函数返回值为3852312。
[函数2]
long fun2(char *str)
{
int i=0;
long k=0;
char *p=str;
while (*p!='\0' &&(3)) {
if (*p>='0' && *p<='9') {
k=(4)+ *p - '0';
++i;
}
(5);
}
return k;
}
第8题
阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明1]
函数void fun(char*w,char x,int*n)用来在w数组中插入x,w数组中的数已按由小到大顺序存放,n指存储单元中存放数组中数据的个数,插入后数组中的数仍有序。
[C函数1]
void fun(char*W,char x,int*n)
{ int i,P;
p=0;
w[*n]=x;
while(x>w[p]) (1) ;
for(i=*n,i>p;i--)w[i]=(2);
w[p]=x;
++*n;
}
[说明2]
函数void revstr(char*s)将字符串s逆置。例如:字符串“abcde”,经过逆置后变为“edcba”。
[C函数2]
void revstr(char*s)
{ char*p,c;
if(s==NULL)return;
p=(3); /*p指向字符串s的最后一个有效字符*/
while(s<p){ /*交换并移动指针*/
C=*s;
(4)=*p;
(5)=c;
}
}
第9题
阅读以下函数说明和C语言函数,将应填入(n)处的字句写在答题纸的对应栏内。
【函数2.1说明】
递归函数sum(int a[], int n)的返回值是数组a[]的前n个元素之和。
【函数2.1】
int sum (int a[],int n)
{
if(n>0) return (1);
else (2);
}
【函数2.2说明】
有3个整数,设计函数compare(int a,int b,int c)求其中最大的数。
【函数2.2】
int compare (int a, int b, int c )
{ int temp, max;
(3) a:b;
(4) temp:c;
}
【函数2.3说明】
递归函数dec(int a[],int n)判断数组a[]的前n个元素是否是不递增的。不递增返回 1,否则返回0。
【函数2.3】
int dec(int a[], int n )
{
if(n<=1) return 1;
if(a[0]<a[1]) return 0;
return (5);
}
第10题
阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。
【说明】
实现矩阵(3行3列)的转置(即行列互换)。
例如,输入下面的矩阵:
100 200 300
400 500 600
700 800 900
程序输出:
100 400 700
200 500 800
300 600 900
【函数】
int fun(int array[3][3])
{
int i,j,t;
for(i=0;(1);i++)
for(j=0;(2);j++)
{
t=array[i][j];
(3);
(4);
}
}
}
main()
{
int i,j;
int array[3][3]={{100,200,300},{400,500,600},{700,800,900}};
clrscr();
for (i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%7d",array[i][j]);
printf("\n");
}
fun((5));
printf("Converted array:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%7d",array[i][j]);
printf("\n");
}
}
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!