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

[填空题]下列给定的程序中,函数proc( )的功能是:判断字符ch是否与str所指字符串中的某个字符相同,若相同,则什么也不做,若不同,则将其插在串的最后。
请修改程序中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
//************found*************
void proc(char str, char eh)

while(*str&&*str! =ch)str++;
//************found*************
if(*str==ch)
str[0]=ch;
//************found***********
str[1]=’0’;


void main( )

char str[81], ch;
system("CLS");
printf("/nPlease enter a string: ");
gets(str);
printf("/n Please enter the character to search:");
ch=getchar( );
proc(str, oh);
printf("/nThe result is%s/n", str);

更多"下列给定的程序中,函数proc( )的功能是:判断字符ch是否与str"的相关试题:

[填空题]下列给定程序中,函数proc( )的功能是逐个比较str1,str2两个字符串对应位置中的字符,把ASCII值大或相等的字符依次存放到str数组中,形成一个新的字符串。
例如,str1中的字符串为fshADfg,str2中的字符串为sdAEdi,则sir中的字符串应为sshEdig。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<string.h>
void proc(char *p, char *q, char *c)
int k=0;
while( *P||*q)
//************found*************
if (*p>=*q)
c[k]=*q;
else c[k]=*p;
if(*p)p++;
if(*q)q++;
//************found*************
k++


void main( )
char str1[10]="fshADfg", str2[10]="sdAEdi", str
[80]=’/0’;
proc(str1, str2, str);
printf("The string str1: "); puts(str1);
printf("The string str2: "); puts(str2);
printf("The result: "); puts(str);

[填空题]下列给定的程序中,proc( )函数的功能是:将str所指字符串中每个单涮的最后一个字母改成大写(这里的“单词”是指有空格隔开的字符串)。
例如,若输入:How do you do
则输出:HoW dO yoU dO
请修改程序中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
#inelude<stdio.h>
void proc(char * str)

int k=0;
for(; *str; str++)
if(k)

//************found*************
if(str==’ ’)

k=0;
//************found*************
*str=toupper(*(str-1));


else
k=1;

void main( )
char chrstr[64];
int d;
system("CLS");
printf("/nPlease enter an English sentence within 63 letters: ");
gets(chrstr);
d=strlen(chrstr);
chrstr[d]=’’;
chrstr[d+1]=0;
printf("/nBofore changing: n%s", chrstr);
proc (chrstr);
printf("/nAfter changing: n%s", chrstr);

[填空题]给定程序中,函数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的功能是:首先把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);

[填空题]下列给定程序中,函数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的功能是:统计substr所指的字符串在str所指的字符串中出现的次数。
例如,若字符串为aaas 1kaaas,子字符串为as,则应输出2。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
int fun(char*str,char*substr)
int i,j,k,num=0;
/*********found*********/
for(i=0,str[i],i++)
for(j=i,k=0;
substr[k]==str[j];
k++,j++)
/*********found*********/
If(substr[k+1]==’/0’)
num ++;
break;

return num;

main( )

char str[80],substr[80];
printf("Input a string:");
gets(str);
printf("Input a substring:");
gets(substr);
printf("%d/n".fun(str,substr));

[简答题]下列给定程序中,函数fun( )的功能是:从s所指字符串中,找出t所指字符串的个数作为函数值返回。例如,当s所指字符串中的内容为abcdabfab,t所指字符串的内容为ab,则函数返回整数3。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
int fun (char *s, char *t)
int n; char *p, *r;
n=0;
while(*s)
p=s;
r=t;
while (*r)
/**************found**************/
if(*r==*p) r++; p++
else break;
/*************found**************/
if(r==’/0’)
n++;
s++;

return n;

main( )
char s[100], t[100]; int m;
clrscr( );
printf("/nPlease enter string s: ");
scanf ("%s",s);
printf("/nPlease enter substring t: ");
scanf ("%s",t);
m=fun (s,t);
printf("/nThe result is: m=%d/n", m);

[填空题]请补充函数proc( ),该函数的功能是将字符串str中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“How Are You”,则输出“how are you”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char *proc(char str[])

int i;
for(i=0; str[i]; i++)

if((str[i]>=’A’)&&( (1) )
(2) ;

return( (3) );

void main( )

char str[81];
printf("/nPlease enter a string: ");
gets(str);
printf("/nThe result string is: /n%s",
proc(str));


我来回答:

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

订单号:

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