题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-03 21:20:20

[填空题]下列给定程序中函数fun( )的功能是:将长整型数中每一位上为偶数的数依次逆向取出,构成一个新数放在t中。高位在低位,低位在高位。例如当s中的数为25846513时,t中的数为6482。
请改正函数fun( )中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conio.h>
void fun(long s,long *t)

int d;
long sl=l,i=1;
*t=0;
while(s/i>0)
i=i*10;
i=i/10;
while(s>0)

d=s/i
/*************found*************/
if(d%2!=0)

/*************found*************/
t=d*sl+t;
sl*=l0;

s=s%i;
i=i/10;


main( )

long s,t;
clrscr( );
printf("/nPlease enter s:");
scanf("%ld",&s);
fun(s,&t);
printf("The result is:%ld/n",t);

更多"下列给定程序中函数fun( )的功能是:将长整型数中每一位上为偶数的数"的相关试题:

[填空题]下列给定程序中函数fun( )的功能是:将长整型数中每一位上为偶数的数依次逆向取出,构成一个新数放在t中。高位在低位,低位在高位。例如当s中的数为25846513时,t中的数为6482。
请改正函数fun( )中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conio.h>
void fun(long s,long *t)

int d;
long sl=l,i=1;
*t=0;
while(s/i>0)
i=i*10;
i=i/10;
while(s>0)

d=s/i
/*************found*************/
if(d%2!=0)

/*************found*************/
t=d*sl+t;
sl*=l0;

s=s%i;
i=i/10;


main( )

long s,t;
clrscr( );
printf("/nPlease enter s:");
scanf("%ld",&s);
fun(s,&t);
printf("The result is:%ld/n",t);

[填空题]下列给定程序中函数fun( )的功能是:将长整型数中每一位上为奇数的数依次取出,构成一个新数放在冲。高位仍在高位,低位仍在低位。例如当s中的数为87653142时,t中的数为7531。
请改正函数fun( )中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conlo.h>
void fun (long s, long *t)
int d;
long s1=1;
/*************found**************/
t=0;
while(s>0)
d=s%10;
/*************found**************/
if(d%2==0)
*t=d*s1+*t;
s1*=10;

s/=10;


main( )
long s, t;
clrscr( );
printf("/nPlease enter s:");scanf("%ld",&s);
fun(s,&t);
printf("The result is:%ld/n",t);

[填空题]下列给定程序中,函数fun( )的功能是:将长整型数中每一位上为偶数的数依次取出,构成一个新数放在冲。高位仍在高位,低位仍在低位。例如,当s中的数为87653142时,t中的数为8642。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main,~数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
void fun(long s,long *t)
/**********************************/
int d;
long s1=l;
*t=0;
while(s>0)
d=s%10;
/**********************************/
if(d%2=0)
*t=d*sl+*t;
sl*=10

/**********************************/
s/=10;


main ( )
long s,t;
clrscr( );
printf("/nPlease enter s: "); scanf
("%ld",&s);
fun(s,&t);
printf("The result is :%ld/n",t);

[填空题]下列给定程序中函数fun的功能是:将长整型数中各位上为奇数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为87653142时,t中的数为7531。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void fun(long s,long*t)

int d;
long s1=1;
/*********found*********/
t=0;
while(s>0)

d=s%10;
/*********found*********/
if(d%2==0)

*t=d*s1+*t:
s1*=10:

s/=10;


void main( )

long s,t;
system("CLS");
printf("/nPlease enter s:");
scanf("%id",&s);
fun(s,&t);
printf("The result is:%id/n",t);

[填空题]下列给定程序中函数proc( )的功能是:将长整型数中每一位上为偶数的数依次逆向取出,构成一个新数放在t中。高位在低位,低位在高位。例如,当s中的数为12345678时,则t中的数为8642。
请修改函数proc( )中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(10ng s,long *t)

int d;
long s1=1, i=1;
*t=0;
while(s/i>0)
i=i*10;
i=i/10;
while(s>0)

d=s/i;
//************found*************
if(d%2! =0)

//************found*************
t=d*s1+t;
s1*=10;

s=s%i;
i=i/10;


void main( )

long s, t;
system("CLS");
printf("/nPlease enter S: ");
scanf("%1d", &s);
proc(s, &t);
printf("The result is: %1d/n", t);

[填空题]给定程序MODI1.C中函数fun的功能是:将长整型数中为偶数的位依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。例如,当s中的数为87653142时,t中的数为8642。
请改正程序中的错误,使它能得出正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
文件MODI1.C内容如下:
#include<stdio.h>
void fun(10ng s,long *t)
int d;
long s1=1;
t=0;
while(s>0)
d=s%10:
/**********found**********/
if(d%2=0)
*t=d*s1+*t; s1*=10;

/**********found**********/
s/=10;


void main( )
long s,t;
printf("/nPlease enter s:");
seanf("%1d",&s);
fun(s,&t);
printf("The result is:%1d/n",t);

[填空题]下列给定程序中函数fun( )的功能是;从低位开始取出长整型变量s中奇数位上的数,依次构成一个新数放在t中。例如,当s中的数为4576235时,t中的数为4725。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<conio.h>
/************found*************/
int fun(long s,long *t)

long s1=l0;
*tis%10;
while(s>0)

/*************found*************/
s=s%100;
*t=s%10*s1+*t;
s1=s1*10;


main( )

long s,t;
clrscr( );
printf("/nPlease enter s:");
scanf("%ld",&s);
fun(s,&t);
printf("The result is:%ld/n",t);

[简答题]给定程序中函数fun的功能是:从低位开始取出长整型变量S中偶数位上的数,依次构成一个新数放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为7654321时,t中的数为642。
请改正程序中的错误,使它能得到正确结果。
[注意] 不要改动main函数,不得增行或删行,也不得更改程序的结构。
[试题源程序]
#include<stdio.h>
/************found***********/
void fun(long s, long t)

long s1=10;
s/=10;
*t=s% 10;
/************found************/
while(s<0)

s=s/100;
*t=s% 10*s1+*t;
s1=s1 *10;


msin( )

long s, t;
printf("/nPlease enter s:");
scanf("%ld", &s);
fun(s, &t);
printf("The result is: %ld/n", t);

[简答题]

给定程序中函数fun的功能是:从低位开始取出长整型变量s中偶数位上的数,依次构成一个新数放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为:7654321时,t中的数为:642。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
[试题源程序]
#include<stdio.h>
/************found************/
void fun(long s,long t)

long s1=10;
s/=10;
*t=s%10;
/************found************/
while(s<0)

s=s/100;
*t=s%10*s1+ *t;
s1=s1*10;


mein( )

long s,t;
printf("/nPlease enter s:");
scanf("%1d",&s);
fun(s,&t);
printf("The result is:%1d/n",t);


[填空题]下列给定程序中函数fun( )的功能是:从低位开始取出长整型变量s中偶数位上的数,依次构成一个新数放在t中。例如,当s中的数为7654321时,t中的数为642。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #include <conio.h> /*************found**************/ void fun(long s,long t) { long s1=10; s/=10; *t=s%10; /*************found**************/ while(s<0) { s=s/100; *t=s%10*s1+*t; s1=s1*10; } } main( ) { long s, t; clrscr( ); printf("/nPlease enter s: "); scanf ("%ld",&s); fun(s,&t); printf("The result is: %ld/n ",t); }
[填空题]由N个有序整数组成的数列已放在一维数组中,下列给定程序函数fun的功能是:利用折半查找法查找整数m在数组中的位置。若找到,返回其下标值;否则,返回-1。
折半查找的基本算法是:每次查找前先确定数组中待查的范围low和high(low<high),然后用m与中间位置(mid)上元素的值进行比较。如果m的值大于中间位置元素的值,则下一次的查找范围落在中间位置之后的元素中;反之,下一次的查找范围落在中间位置之前的元素中,直到low>high,查找结束。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#define N 10
/**********found**********/
void fun(int a[],int m)
int low=0,high=N-1,mid;
while(low<=high)
mid=(low+high)/2;
if(m<a[mid])
high=mid-1;
/********found**********/
else if(m>a[mid])
low=mid+1;
else return(mid);

return(-1);

void main( )
int i,a[N]=(-3,4,7,9,13,45,67,89,100,180),
k,m;
printf("a数组中的数据如下:");
for(i=0;i<N;i++)
printf("%d",a[i]);
printf("Enter m:");
scanf("%d",&m);
k=fun(a,m);
if(k>=0)
printf("m=%d,index=%d/n",m,k);
else printf("Not be found /n");

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码