题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-23 03:06:02

[填空题]请补充函数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函数,该函数的功能是:把字符的ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串中,字符串str从键盘输入,其长度作为参数传入fun函数。
例如,输入“abcdef”则输出“bdf”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 100
void (1)

int i,j;
(2)
for(i=0;i<n;i++)
char str[N];
printf("please input a string:/n");
gets(str);
while(str[i]!=’/0’)

len++;
if(s[i]%2==0)
s[j++]=s[i];
(3)

main( )

int i=0,len=0;
i++;

fun(str,len);
printf("The result 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 #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( ),该函数的功能是:把从主函数中输入的字符串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"); puts(str1); puts(str2); fun(str1,str2); printf("*** The new string ***/n"); puts (str1); }
[填空题]请补充fun函数,该函数的功能是:按’0’到’9’统计一个字符串中的奇数数字字符各自出现的次数,结果保存在数组num中。注意:不能使用字符串库函数。
例如,输入“x=1123.456+0.909*bc”,结果为:1=2,3=1,5=1,7=0,9=2。
[注意] 部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
[试题源程序]
#include<conio.h>
#include<stdio.h>
#define N 20
fun(char*tt, int num[])

int i, j;
int bb[10];
char *p=tt;
for(i=0;i<10; i++)

num[i]=0;
bb[i]=0;

while( )

if(*p>=’0’&&*p<=’9’)
;
p++;

for(i=i, J=0; i<10; i=i+2, j++)
;

main( )

char str[N];
int num[10], k;
cirscr( );
printf("//nplease enter a string:");
gets(str);
printf("//n*******The original string*******//n");
puts(str);
fun(str, num);
printf("//n******The number of letter********//n”);
for(k=0; k<5; k++)

printf("//n");
printf("%d=%d ", 2*k+1, hum[k]);

printf("//n");
return;

[简答题]填空题 请补充函数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);


我来回答:

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

订单号:

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