题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-07 00:42:41

[填空题]下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有大写字母’F’。 请改正程序中的错误,使它能得到正确结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <stdio.h> void fun(char *s) { int i, j; /*************found**************/ for(i=j=0; s[i]!= ’0’;i++) if(s[i] != ’F’) /*************found**************/ s[j]=s[i]; s[j]=’/0’; } main ( ) { char s[80]; printf("/nEnter a string: "); gets(s); printf("The original string: "); puts(s); fun(s); printf("The string after deleted: "); puts(s); printf("/n/n "); }

更多"下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有大写字"的相关试题:

[填空题]下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有大写字母’F’。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
void fun(char *s)

int i, j;
/*************found**************/
for(i=j=0; s[i]!= ’0’;i++)
if(s[i] != ’F’)
/*************found**************/
s[j]=s[i];
s[j]=’/0’;

main ( )

char s[80];
printf("/nEnter a string: ");
gets(s);
printf("The original string: ");
puts(s);
fun(s);
printf("The string after deleted: ");
puts(s);
printf("/n/n ");

[简答题]下列给定程序中,函数fun的功能是:求两个非零正整数的最大公约数,并作为函数值返回。
请改正程序中的错误,使它能得出正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
int fun(int a, int b)
int r, t;
if(a<b)
t=a; b=a; a=t;
/******************found*******************/

r=a%b;
while(r!=0)
a=b; b=r; r=a%b;
/******************found*******************/
return(a);

void main( )
int num1, num2, a;
printf("Input num1 num2:");
scanf("%d%d", &num1, &num2);
printf("num1=%d num2=%d/n/n", num1, num2);
a=fun(num1, num2);
printf("The maximun common divisor is%d/n/n",a);

[填空题]下列给定程序中fun( )函数的功能是:将n个无序整数从小到大排序。 请改正程序中的错误,使它能得出正确的结果。 注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <conio.h> #include <stdio.h> #include <stdlib.h> fun(int n, int *a) { int i,j,p,t; for (j=0;j<n-1;j++) { P=j; /***************found*******************/ for(i=j+l;i<n-1;i++) if (a[p]>a[i]) /***************found*******************/ t=i; if (p!=j) {t=a[j];a[j]=a[p];a[p]=t;} } } putarr( iht n,int *z) {int i; for (i=l;i<=n;i++,z++) { printf("%4d",*z); if (!(i%10)) printf("/n"); } printf ("/n"); } main ( ) {int aa[20]={9,3,0,4,1,2,5,6,8,10,7},n=11; clrscr( ); printf("/n/nBefore sorting %d numbers:/n",n); putarr(n,aa); fun(n,aa); printf("/nAfter sorting %d numbers:/n",n);putarr(n,aa); }
[简答题]给定程序MODI1.C中fun( )函数的功能是:将n个无序整数从小到大排序。
请改正程序中的错误,使它能得出正确的结果。
#include<stdio.h>
#include<stdlib.h>
fun(int n,int *a)
int i,j,p,t;
for(j=0;j<n-1;j++)
p=j;
/**********found**********/
for(i=j+1;i<n-1;i++)
if(a[p]>a[i])
/**********found**********/
t=i;
if(p!=j)
t=a[j];a[j]=a[p];a[p]=t;)


putarr(int n,int *z)
int i;
for(i=1;i<= n;i++,z++)
printf("%4d",*z);
if(!(i%10))printf("/n");
printf("/n");

main( )
int aa[20]=(9,3,0,4,1,2,5,6,8,
10,7,n=11;
printf("/n/nBefore sorting %d numbers:/q",n);putarr(n,aa);
fun(n,aa);
printf("/nAfter sorting %d numbers:/n",n);putarr(n,aa);

[填空题]下列给定程序中fun( )函数的功能是:将n个无序整数从小到大排序。
请改正程序中的错误,使它能得出正确的结果。
注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
fun(int n, int *a)
int i,j,p,t;
for (j=0;j<n-1;j++)
P=j;
/***************found*******************/
for(i=j+l;i<n-1;i++)
if (a[p]>a[i])
/***************found*******************/
t=i;
if (p!=j)
t=a[j];a[j]=a[p];a[p]=t;


putarr( iht n,int *z)
int i;
for (i=l;i<=n;i++,z++)
printf("%4d",*z);
if (!(i%10)) printf("/n");
printf ("/n");

main ( )
int aa[20]=9,3,0,4,1,2,5,6,8,10,7,n=11;
clrscr( );
printf("/n/nBefore sorting %d numbers:/n",n); putarr(n,aa);
fun(n,aa);
printf("/nAfter sorting %d numbers:/n",n);putarr(n,aa);

[简答题]下列给定程序中,函数fun的功能是:计算整数n的阶乘。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdlib.h>
#include <stdio.h>
double fun(int n)
double result=1.0;
while(n>1&&n<170)
/******************found*******************/
result*=--n;
/******************found*******************/
Return;

void main( )
int n;
system("CLS");
printf("Enter an integer:");
scanf("%d", &n);
printf("/n/n%d!=%1dn/n", n, fun(n));

[填空题]下列给定程序中,函数fun( )的功能是:计算整数n的阶乘。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
double fun(int n)

double result=l.0;
whil (n>l&&n<170)
/**************found********************/
result*=--n;
/**************found********************/
return;
main( )
int. n;
clrscr( );
printf("Enter an integer: ");
scanf("%d",&n);
printf("/n/n%d!=%lg/n/n ",n, fun(n));

[填空题]下列给定程序中,函数fun( )的功能是:从字符串s中,删除所有小写字母’c’。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构.
试题程序:
# include <stdio.h>
void fun(char *s)
int i, j;
for(i=j=0; s[i] != ’/0’;i++)
if(sill != ’c’)
/********************************/
s [j] =s [i];
/**************found*************/
s[i]=’/0’;

main ( )
char s[80];
printf ("/nEnter a string: ");
gets (s);
printf("The original string: ")
puts (s);
fun (s);
printf("The string after deleted: ");
puts (s); printf ("/n/n "):

[简答题]下列给定程序中,函数fun的功能是:用冒泡法对6个字符串进行升序排列。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdlib.h >
#include <string.h>
#include <conio.h>
#include <stdio.h>
#define MAXLINE 20
fun (char * pstr[6])

int i, j;
char * p;
for(i=0; i<5; i++)

/********** found********** /
for(j=i+1, j<6, j++)

if (strcmp (* (pstr+i), (pstr+
j))>0)

p=* (pstr+i);
/********** found********** /
* (pstr+i)=pstr+j;
* (pstr+j)=p;




void main ( )

int i;
char * pstr[6], str[6] [MAXLINE];
system ("CLS");
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 sor-
ting:/n ");
for (i=0; i<6; i++)
printf ("% s/n ", pstr[i])
[简答题]下列给定程序中,函数fun的功能是:用冒泡法对6个字符串按由小到大的顺序排列。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<stdio.h>
#define MAXLINE 20
fun(char*pstr[6])

lnt i,j;
char *p;
for(i=O;i<5;i++)

/********found********/
for(j=i+l,j<6,j++)

if(strcmp(*(pstr+i)*(pstr+j))>0)

P=*(psfr+i);
/********found********/
*(pstr+i)=pstr+j;
*(pstr+j)=p;




void main( )

int i;
char*pstr[6],str[6][MAXLINE];
system("CLS");
for(i=O;i<6;i++)
pstr[i]=str[i];
printf("/nEnter 6 string(1 string at eachline):/n");
for(i=0;i<6;i++)
scanf("%s",pstr[i]);
fun(pstr);
printf("The strings after sorting:/n");
for(i=O;i<6;i++)
printf("%s/n"pstr[i]);

[填空题]给定程序中,函数fun( )的功能是:使数组中的元素的值缩小5倍。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #include<conio.h> float m[10]; /*************found**************/ int fun (void) { int j; printf("In subfunc after calling/n"); for(j=O;j<lO;j++) { ; /*************found**************/ print ("%f ",m[j]%5); } } main( ) { int i; printf ("In main before calling/n"); for (i=0;i<10;i++) { m[i]=i+20; printf("%f ",m[i]); } fun( ); printf("/nIn main after calling/n"); for(i=O; i<10;i++) printf("%f ",m[i]/5); }
[填空题]下列给定程序中,函数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
我已记住账号密码