题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-07 18:00:06

[填空题]给定程序MODI1.C中函数fun的功能是:将s所指字符串中的字母转换为按字母顺序的后续字母(但Z转换为A,z转换为a),其他字符不变。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
文件MODI1.C内容如下:
#include<stdio.h>
#include<ctype.h>
void fun(char *s)
/**********found**********/
while(*s!=’@’)

if(*s>=’A’&&*s<=’Z’||*s>=’a’&&*s<=’z’)
if(*s==’Z’) *s=’A’;
else if(*s==’z’) *s=’a’;
else *s+=1:

/**********found**********/
(*s)++;


void main( )
char s[80];
printf("/n Enter a string with length<80. :/n/n");
gets(s);
printf("/n The string: /n/n");
puts(s);
fun(s);
printf("/n/n Tile Cords: /n/n");
puts(s);

更多"给定程序MODI1.C中函数fun的功能是:将s所指字符串中的字母转换"的相关试题:

[填空题]下列给定程序中,函数fun的功能是:将str所指字符串中的字母转换为按字母序列的后续字母(Z转换A,z转换a),其他字符不变。
请修改函数fun中的错误,得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
void fun(char*str)

/*******found*********/
while(*str!=’@’)

if(*str>=’A’&&*str<=’Z’||*str<=’a’&&*str<=’z’)

if(*str==’Z’)
*str=’A’;
else if(*str==’z’)
*str=’a’;
else
*str+=1;

/*******found*********/
(*str)++;


main( )

char str[80];
printf("/n Enter a string with length<80.:/n/n");
gets(str);printf("/n The string:/n/n");
puts(str);
fun(str);
printf("/n/n The Cords:/n/n");
puts(str);

[填空题]下列给定程序中,函数fun( )的功能是;将s所指字符串中的字母转换为按字母序列的后续字母(但Z转化为A,z转化为 a),其他字符不变。 请改正函数fun( )中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <stdio.h> #include <ctype.h> #include <conio.h> void fun(char *s) /*************found**************/ { while(*s!=’@’) { if(*s>=’A’ &*s<=’z’||*s>=’a’&&*s<=’z’) {if(*s==’Z’) *S=’A’; else if(*S==’z’) *s=’a’; else *s+=1; } /*************found**************/ (*s)++; } } main( ) { char s[80]; clrscr( ); printf("/n Enter a string with length <80:/n/n");gets(s); printf("/n The string:/n/n");puts(s); fun(s); printf("/n/n The Cords:/n/n");puts(s); }
[简答题]函数fun( )的功能是:将s所指字符串中的字母转换为按字母序列排列的其后续字母(注:Z转换为A,z转换为a),其他字符不变。
改正函数fun( )中指定部分的错误,使它能得出正确的结果。
#include<stdio.h>
#include<ctype.h>
void fun(char *s)

/**********found**********/
while(*s!=’@’)
if(*s>=’A’&&*s<=’Z’||*s>=’a’&&*s<=’z’)
if(*s==’Z’)*s=’A’;
else if(*s==’Z’)*s=’a’;
else *s+=1;

/**********found**********/
(*s)++;


main( )
char s[80];
printf("/n Enter a string with length<80.:/n/n");gets(s);
print"/n The string:/n/n");puts(s);
fun(s);
printf("/n/n The Cords:/n/n");puts(s);

[填空题]给定程序中,函数fun的功能是:求出形参ss所指字符串数组中最长字符串的长度,其余字符串左边用字符*补齐,使其与最长的字符串等长。字符串数组中共有M个字符串,且串长小于N。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <string.h>
#defineM 5
#defineN 20
void fun (char (*ss)[N])
inti, j, k=0, n, m, len;
for(i=0; i<M; i++)
len=strlen(ss[i]);
if(i==0)n=len;
if (len>n)
/******************found*******************/
n=len; (1) =i;


for(i=0; i<M; i++)
if(if=k)
m=n;
len=strlen(ss[i]);
/******************found*******************/
for (j= (2) ; j>=0; j--)
ss[i][m--]=ss[i][j];
for (j=0; j<n-len; j++)
/******************found*******************/
(3) =’*’;


main( )
char ss[M][N]="shanghai", "guangzhou",
"beijing", "tianjin", "chongqing");
int i;
printf("/nThe original strings are:/n");
for(i=0; i<M; i++)
[填空题]在给定程序中,函数fun的功能是:求出形参SS所指字符串数组中最长字符串的长度,其余字符串左边用字符*补齐,使其与最长的字符串等长。字符串数组中共有M个字符串,且串长<N。
请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构。
文件BLANK1.C内容如下:
#include<stdio.h>
#include<string.h>
#define M 5
#define N 20
void fun(char( *ss)[N])
int i,j,k=0,n,m,len;
for(i=0;i<M;i++)
len=strlen(ss[i]);
if(i==0)n=len:
if(len>n)
/**********found**********/
n=len;
(1) =i;


for(i=0;i<M;i++)
if(i!=k)
m=n:
len=strlen(ss[i]);
/***********found***********/
for(j= (2) ;j>=0;j--)ss[i][m--]=ss[i][j];
for(j=0;j<n-len;j++)
/**********found**********/
(3) =’*’:

void main( )
char ss[M][N]="shanghai","guangzhou","beijing","tianjing","cchongqing";
int i;
printf("/nThe original strings are: /n");
for(i=0;i<M;i++)printf("%s/n",ss[i]);
printf("/n");
fun(ss);
printf("/nThe resuh
[填空题]下列给定程序中,函数fun( )的功能是:依次取出字符串中所有的字母,形成新的字符串,并取代原字符串。 请改正程序中的错误,使它能得到正确结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #include<conio.h> void fun(char*S) { int i,j; for(i=0,j=0;s[i]! =’/0’;i++) /*************found************/ if((s[i]>=’A’&&s[i]<=’Z’)&&(s[i]>= ’a’&&S[i]<=’z’,)) s[j++]=s[i]; /*************found*************/ s[j]="/0"; } main( ) { char item[80]; clrscr( ); printf("/nEnter a string:"); gets(item); printf("/n/nThe string is:/%s/n",item); fun (item); printf("/n/nThe string of changing is:/%S/n",item); }
[简答题]给定程序中,函数fun的功能是将参数给定的字符串、整数、浮点数写到文本文件中,再用字符串方式从此文本文件中逐个读入,并调用库函数atoi和atof将字符串转换成相应的整数、浮点数,然后将其显示在屏幕上。 请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。 注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构! 给定源程序: #include #include void fun(char *s, int a, double f) { /**********found**********/ __1__ fp; char str[100], str1[100], str2[100]; int a1; double f1; fp = fopen("file1.txt", "w"); fprintf(fp, "%s %d %f/n", s, a, f); /**********found**********/ __2__ ; fp = fopen("file1.txt", "r"); /**********found**********/ fscanf(__3__,"%s%s%s", str, str1, str2); fclose(fp); a1 = atoi(str1); f1 = atof(str2); printf("/nThe result :/n/n%s %d %f/n", str, a1, f1); } main( ) { char a[10]="Hello!"; int b=12345; double c= 98.76; fun(a,b,c); }
[填空题]给定程序MODI1.C函数fun的功能是:依次取出字符串中所有数字字符,形成新的字符串,并取代原字符串。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
文件MODI1.C内容如下:
#include<stdio.h>
void fun(char *s)
int i,j;
for(i=0,j=0; s[i]!=’/0’;i++)
if(s[i]>=’0’&& s[i]<=’9’)
/**********found**********/
s[j]=s[i];
/**********found**********/
S[j]="/0";

void main( )
char item[80];
printf("/nEnter a string:");
gets(item);
printf("/n/nThe string is:/"%s/"/n",item);
fun(item);
printf("/n/nThe string of changing is: /"%s/"/n",item);

[简答题]给定程序中函数fun的功能是:首先把b所指字符串中的字符按逆序存放,然后将a所指字符串中的字符和b所指字符串中的字符,按排列的顺序交叉合并到c所指数组中,过长的剩余字符接在c所指的数组的尾部。例如,当a所指字符串中的内容为“abcdefg”,b所指字符串中的内容为“1234”时,c所指数组中的内容应“a4b3c2dlefg”;而当a所指字符串中的内容为“1234”,b所指字符串的内容为“abcdefg”时,c所指数组中的内容应该为“lg2f3e4dcba”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <string.h>
void fun (char*a, char*, char *c)

inti, j; char ch;
i=0; j=strlen(b)-1;
/******************found*******************/
while(i>j)
ch=b[i]; b[i]=b[j]; b[j]=ch;
i++; j--;

while (*a|| *b)
/******************found*******************/
If(*a)
*c=*a; c++; a++;
if(*b)
*c=*b; c++; b++;

*c=0;

main( )

char s1[100], s2[100], t[200];
printf("/nEnter s1 string:"); scanf("%s", s1);
printf("/nEnter s2 string:"); scanf("%s", s2);
fun(s1, s2, t);
printf("/nThe result is: %s/n", t);

我来回答:

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

订单号:

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