题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-29 21:39:59

[填空题]请补充函数fun( ),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun( )。
例如,输入“abcdefghijkl”,输出“cdfhl”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun(char s[],int n)

int i, j, k, flag;
【1】 ;
for(i=0; i<n; i++)

if (i>1)
s [k++] =s [i];
flag=I;
for( 【2】 ; j<i&&flag; j++)
if (i%j==0)

flag=0;
【3】


s [k]=’/0’;

main( )

int i=0, strlen=0;
char str[N];
clrscr ( );
printf("/n Input a string:/n");
gets (str);
while (str [i] !=’/0’)

strlen++;
i++;

fun (str, strlen);
printf("/n*** display string ***/n");
puts (str);

更多"请补充函数fun( ),该函数的功能是:把字符下标为非素数的字符从字符"的相关试题:

[填空题]请补充函数fun( ),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun( )。 例如,输入“abcdefghijkl”,输出“cdfhl”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #define N 80 void fun(char s[],int n) { int i, j, k, flag; 【1】 ; for(i=0; i<n; i++) { if (i>1) s [k++] =s [i]; flag=I; for( 【2】 ; j<i&&flag; j++) if (i%j==0) { flag=0; 【3】 } } s [k]=’/0’; } main( ) { int i=0, strlen=0; char str[N]; clrscr ( ); printf("/n Input a string:/n"); gets (str); while (str [i] !=’/0’) { strlen++; i++; } fun (str, strlen); printf("/n*** display string ***/n"); puts (str); }
[填空题]请补充函数fun( ),该函数的功能是:把字符下标能铍2或3整除的字符从字符串str中删除,把剩余的字符重新保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun( )。
例如,输入“abcdefghijk”,输出“bfh”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun(char s[], int n)

int i, k;
【1】
for(i=0; i<n; i++)

s[k++]=s[i];
if( 【2】 )
k--;

【3】

main( )

int i=0,strlen=0;
char str[N];
clrscr( );
printf("/nInput a string:/n");
gets(str);
while(str[i]!=’/0’)

strlen++;
i++;

fun(str,strlen);
printf(’/n*** display string ***/n");
puts(str);

[填空题]请补充函数fun( ),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> void fun(char *s) { int i=0; char *p=s; while( 【1】 ) { if (*p>=’a’&&*p<=’z’) { s[i]=*p; 【2】 ; } p++; } s[i]= 【3】 ; } main( ) { char str[80]; clrscr( ); printf("/nEnter a string:"); gets(str); printf("/n/nThe string is:/%s/n",str); fun(str); printf("/n/nThe string of changing is:/%s/n",str); }
[填空题]请补充函数fun( ),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。 例如:str1=“How do”,str2=“you do”,结果输出:How do you do 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> #define N 40 void fun(char *str1,char *str2) { int i=0; char *p1=str1; char *p2=str2; while( 【1】 ) i++; for( ; 【2】 ;i++) *(p1+i)= 【3】 ; *(p1+i)=’/0’; } main( ) { char str1[N],str2[N); clrscr( ); printf("*****Input the string str1 & str2*****/n"); printf("/nstr1:"); gets(str1); printf("/nstr2:"); gets(str2); printf("**The string str1 & str2**/n"); puts(str1); puts(str2); fun(str1,str2); printf("*****The new string *****/n"); puts(str1); }
[填空题]请补充函数fun( ),该函数的功能是:把从主函数中输入的字符串str2倒置后接在字符串str1后面。
例如:str1=“How do”,str2=“od uoy”,结果输出:“How do you do”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 40
void fun(char *str1,char *str2)

int i=0,j=0,k=0,n;
char ch;
char *p1=str1;
char *p2=str2;
while(*(p1+i))
i++;
while(*(p2+j))
j++;
n= 【1】
for(;k=j/2;k++,j--)

ch=*(p2+k);
*(p2+k)=*(p2+j);
*(p2+j)=ch;

【2】
for(; 【3】 ;i++)
*(p1+i)=*p2++;
*(p1+i)=’/0’;

main( )

char str1[N],str2[N];
int m,n,k;
clrscr( );
printf("***Input the string str1 & str2
***/n");
printf("/nstr1:");
gets(str1);
printf("/nstr2:");
gets(str2);
printf("***The string str1 & str2 ***/n");
p
[简答题]填空题 请补充函数fun( ),该函数的功能是:把从主函数中输入的字符串str2倒置后接在字符串str1后面。 例如:str1=“How do”,str2=“od uoy”,结果输出:“How do you do”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #define N 40 void fun(char *str1,char *str2) { int i=0,j=0,k=0,n; char ch; char *p1=str1; char *p2=str2; while(*(p1+i)) i++; while(*(p2+j)) j++; n=【1】; for(;k<=j/2;k++,j--) { ch=*(p2+k); *(p2+k)=*(p2+j); *(p2+j)=ch; } 【2】; for(;【3】;i++) *(p1+i)=*p2++; *(p1+i)=’’/0’’; } main( ) { char str1[N],str2[N]; int m,n,k; clrscr( ); printf("***Input the string str1 & str2 ***/n"); printf("/nstr1:"); gets(str1); printf("/nstr2:"); gets(str2); printf("*** The string str1 & str2 ***/n"); puts(str1); puts(str2); fun(str1,str2); printf("*** The new string ***/n"); puts(str1); }
[简答题]填空题 请补充函数fun( ),该函数的功能是:把字符串str中的字符按字符的ASCII码降序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传入。 例如,如果输入“cdefgh”,则输出为“hgfedc”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include #define N 80 void fun(char s[],int n) { int i, j; char ch; for(i=0;i
[填空题]请补充fun函数,该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组S中。例如,当n=123时,s="321"。
注意:部分源程序已给出。
淆勿改动主函数main和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define M 80
char s[M];
void fun(long int n)

int j=0;
while( (1) )

s[j]= (2)
n/=10;
j++;

(3)

main( )

long int n=1234567;
printf("The origial data/n");
printf("n=%1d",n);
fun(n);
printf("/n%s",s);


[填空题]str是一个由数字和字母字符组成的字符串,由变量num传入字符串长度。请补充函数fun( ),该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。 例如:str=“Bcdl23e456hui890”,结果为:123456890。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 80 int bb[N]; int fun(char s[ ],int bb[ ],int num) { int i,n=0; for(i=0;i<num;i++) { if( 【1】 ) { bb[n]= 【2】 ; n++; } } return 【3】 ; } main( ) { char str[N]; int num=0,n,i; printf("Enter a string:/n"); gets(str); while(str[num]) num++; n=fun(str,bb,num); printf("/nbb="); for(i=0;i<n;i++) printf("%d",bb[i]); }
[填空题]请补充函数fun( ),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码降序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传入。 例如,如果输入“cdefgh”,则输出为“hgfedc”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #define N 80 void fun (char s [], int n) { int i, j; char ch; for (i=0; i<n; i++) for(j= 【1】 ;j<n;j++) if (s[i]<s [j]) { ch=s [j]; 【2】 ; s [i] =ch; } main ( ) { int i=0, strlen=0; char str [N]; clrscr ( ); printf ("/nInput a string: /n"); gets (str); while (str [i] !=’ /0’) { strlen++; i++; } fun (str, strlen); printf ("/n***display string ***/n"); puts (str); }
[填空题]请补充函数fun( ),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun( )。 例如,输入“abcdef”,输出“bdf”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #define N 80 void fun(char s[],int n) { int i, j; j=0; for(i=0; 【1】 ;i++) { if( 【2】 ) s [j++]-s [i]; } 【3】 ; } main ( ) { int i=0, strlen=0; char str [N]; clrscr ( ); printf ("/nInput a string: /n"); gets (str); while (str [i] !=’/0’) { strlen++; i++; } fun(str, strlen); printf("/n*** display string ***/n"); puts (str); }

我来回答:

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

订单号:

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