题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-08-01 21:31:57

[填空题]下列给定程序中,函数fun( )的功能是:将m(1≤m≤10)个字符串反着连接起来,组成一个新串,放入pt所指字符串中,例如:把3个串DEG,ac,df反着串联起来,结果是dfacDEG。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或者删行,也不得改变程序的结构!
试题程序:
#include <conio.h>
#include <string.h>
#include <stdio.h>
void fun(char str[][10],int m,char *pt)

int k,q,i,j=0;
/*************found*************/
for(k=m;k>0;k--)

q=strlen(str[k]);
j+=q;
for(i=0;i<q;i++)
pt[i]=str[k][i];
pt+=q;
pt[0]=0;

/*************found**************/
pt=j;

main( )
int m,h;
char s[10][10],p[120];
clrscr( );
printf("/nPlease enter m:");
scanf("%d",& m);
printf("/nPlease enter%d string:/n",m);
gets(s[0]);
for(h=0;h<m;h++)
gets(s[h]);
fun(s,m,p);
printf("/nThe result is:%s/n",p);

更多"下列给定程序中,函数fun( )的功能是:将m(1≤m≤10)个字符串"的相关试题:

[填空题]下列给定程序中,函数fun( )的功能是:将m(1≤m≤10)个字符串连接起来,组成一个新串,放入pt所指字符串中,例如:把3个串abc,CD,EF串联起来,结果是abcCDEF。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <conio.h> #include <string.h> #include <stdio.h> /*************found**************/ int fun(char str[] [10],int m, char *pt) { int k,q,i,j=0; for(k=0;k<m;k++) { q=strlen(str[k]); j+=q; for(i=0;i<q;i++) /*************found**************/ pt[i]=str[k,i]; pt+=q; pt[0] =0; } pt-=j; } main ( ) { int m, h; char s[10] [10],p[120]; clrscr ( ); printf("/nPlease enter m: "); scanf("%d",&m); gets(s[0]); printf ("/nPlease enter %d string:In ",m); for(h=0;h<m;h++) gets(s[h]); fun (s,m,p); printf("/nThe result is :%s/n ",p); }
[填空题]下列给定程序中,函数fun( )的功能是:将m(1≤m≤10)个字符串反着连接起来,组成一个新串,放入pt所指字符串中,例如:把3个串DEG,ac,df反着串联起来,结果是dfacDEG。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main( )函数,不得增行或者删行,也不得改变程序的结构! 试题程序: #include <conio.h> #include <string.h> #include <stdio.h> void fun(char str[][10],int m,char *pt) { int k,q,i,j=0; /*************found*************/ for(k=m;k>0;k--) { q=strlen(str[k]); j+=q; for(i=0;i<q;i++) pt[i]=str[k][i]; pt+=q; pt[0]=0; } /*************found**************/ pt=j; } main( ) { int m,h; char s[10][10],p[120]; clrscr( ); printf("/nPlease enter m:"); scanf("%d",& m); printf("/nPlease enter%d string:/n",m); gets(s[0]); for(h=0;h<m;h++) gets(s[h]); fun(s,m,p); printf("/nThe result is:%s/n",p); }
[填空题]C++中将两个字符串连接起来组成一个字符串的函数是______。
[填空题]下列给定程序中函数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的功能是:将长整型数中各位上为奇数的数依次取出,构成一个新数放在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);

[填空题]下列给定程序中函数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);

[填空题]下列给定程序中函数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( )的功能是计算并输出high以内的素数之和。high由主函数传给fun( )函数。若high的值为 100,则函数的值为1060。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <math.h>
int fun(int high)

int sum=0,n=0,j,yes;
while(high>=2)

yes=1;
for(j=2;j<=high/2;j++)
/*************found**************/
ifhigh%j==0

yes=0;
break;

/*************found**************/
if(yes==0)

sum+=high;
n++;

high--;

return sum;
main( )

clrscr( );
printf("%d/n",fun(100));

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码