题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-14 19:15:49

[填空题]下列给定程序中,函数proc( )的功能是:依次取出字符串中所有的字母字符,形成新的字符串,并取代原字符串。
例如,若输入的字符串是:ab232bd34bkw,则输出结果是:abbdbkw。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(char * str)

int i, j;
for(i=0, j=0; str[i]!=’/0’; i++)
//************found*************
if((str[i]>=’A’ &&str[i]<=’z’)&&(str[i]>=’a’&&str[i]<=’z’))
str[j++]=str[i];
//************found*************
str[j]="/0";

void main( )

char item[80];
system("CLS");
printf("/nEnter a string: ");
gets(item);
printf("/n/nThe string is:%s/n", item);
proc(item);
printf("/n/nThe string of changing is: %sin", item);

更多"下列给定程序中,函数proc( )的功能是:依次取出字符串中所有的字母"的相关试题:

[填空题]下列给定程序中,函数proc( )的功能是:依次取出字符串中所有的数字字符,形成新的字符串,并取代原字符串。例如原始字符串是“ab45c6djfd789”,则输出后的字符是“456789”。
请修改函数proc( )中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(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 str[80];
system("CLS");
printf("/nEnter a string:");gets(str);
printf("/n/nThe string is:%s/n",str);
proc(str);
printf("/n/nThe string of changing is:%s/n",str);

[填空题]下列给定程序中,函数proc( )的功能是:在字符串的最前端加入m个*号,形成新串,并且覆盖原串。
例如,用户输入字符串abcd(以回车键结束),然后输入m值为3,则结果为***abcd。
注意:字符串的长度最长允许79。
请修改函数proc( )中的错误,使它能得出正确的结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h)
#include<string.h>
#include<conio.h>
void proc(char str[], int m)

char a[80], *p;
int i;
//************found*************
str=p;
for(i=0; i<m; i++)a[i]=’*’;
do
a[i]=*p;
//************found*************
i++;

while(*p);
//************found*************
a[i]=0;
strcpy(str, a);

void main( )
int m; char str [so];
system("CLS");
printf("/nEnter a string: "); gets(str);
printf("/nThe string: %s/n", str);
printf("/nEnter n(number of *): ");
scanf("%d", &m);
proc(str, m);
printf("/nThe string after inster: %s/n", 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( )的功能是:判断字符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( )的功能是:用冒泡法对6个字符串按由小到大的顺序进行排序。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#define MAX 20
void proc(char * pstr[6])

int i, j;
char *p;
for(i=0; i<5; i++)
for(j=i+1; j<6; j++)
//************found*************
if(strcmp((pstr+i), (pstr+j))>0)

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


void main( )

int i;
char *p[6], str[6] [MAX];
system("CLS");
for(i=0; i<6; i++)
p[i]=str[i];
printf("/nEnter 6 string(1 string at each line): /n");
for(i=0; i<6; i++)
scanf("%s", p[i]);
proc(p);
printf("The strings after sorting: /n");
for(i=0; i<6; i++)
printf("%s/n", p[i]);

[填空题]给定程序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);

[填空题]下列给定的程序中,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( )的功能是:依次取出字符串中所有的数字字符,形成新的字符串,并取代原字符串。 请改正函数fun( )中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <stdio.h> #include <conio.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"; } 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( )的功能是:依次取出字符串中所有的字母,形成新的字符串,并取代原字符串。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动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);

[填空题]请补充函数proc( ),该函数的功能是判断一个数是否为回文数。当字符串是回文数时,函数返回字符串:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如,abcdcba。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<string.h>
#include<stdio.h>
char *proc(char*str)

char *str1, *str2;
int i, t=0;
str1=str; str2=str+str1en(str)-1;
for(i=0; (1) ; i++)
if( (2) )

t=1;
break;

if( (3) )
return("yes!");
else
return("no!");

void main( )

char str[50];
printf("Input: ");
scanf("%s", str);
printf("%s/n", proc(str));


[多项选择]请编写函数proc( ),该函数的功能是:将放在字符串数组中的M个字符串(每串的长度不超过N),按顺序合并组成一个新的字符串。
例如,若字符串数组中的M个字符串为:
A. 则合并后的字符串内容应该是BCDEFGCDEFGHI
B. void main()char str[M][N]=("", "BCDEFG", "CDEFGHI"), i;
[简答题]请编写一个函数proc( ),它的功能是:比较两个字符串的长度(不得调用C语言中求字符串长度的函数),函数返回较长的字符串。若两个字符串长度相等,则返回第1个字符串。
例如,若输入jiangxi<CR>
beijing<CR>(<CR>为回车键)
则函数返回jiangxi。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
char * proc(char *s, char *t)


void main( )

char a[20], b[10], *p, *q;
printf("Input 1th string: ");
gets(a);
printf("Input 2th string: ");
gets(b);
printf("%s", proc(a,b));

[填空题]请补充函数proc( ),该函数的功能是按条件删除一个字符串指定字符一半的数目,具体要求如下:如果该字符串所包含的指定字符的个数是奇数,则不删除,如果其数目是偶数,则删除原串后半部分的指定字符。其中,str指向原字符串,删除后的字符串存放在b所指的数组中,e中存放指定的字符。例如,当str输入“abcabcabcab”,c=“b”时,b的输出为“abcabcaca”;如果str的输入为“abcabeabca”,则b的输出为“abcabcabca”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#define M 80
void proc(char str[], char b[], char c)

int i=0, j=0;
int n=0;
int m=0;
while(str[i]!=’/0’)

if(str[i]==c)
n++;
i++;

(1) ;
if (n%2)

while(str[j]!=’/0’)

b[j]=str[j];
j++;

b[j]=’/0’;

else

while(str[i]!=’/0’)

b[j++]=str[i];
if(str[i]==c)
m++;
if((m>n/2)&&(str[i]==c))
(2) ;
i++;

(3) ;


void main( )

char str[M], b[M];
char c;
system("CLS");
printf("Enter the string: /n");
gets(str);

我来回答:

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

订单号:

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