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

[填空题]数组str全由大小写字母字符组成。请补充函数fun( ),该函数的功能是:把str中的字母转换成紧接着的下一个字母,如果原来的字母为‘z’或‘Z’,则相应地转换成‘a’或‘A’,结果仍保存在原数组中。
例如,输入“StudentZz”,则输出“TuvefouAa”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(char s[])

int i;
for(i=0; 【1】 ;i++)

if(s[i]==’z’||s[i]=’Z’)
s[i]-= 【2】
else
s[i]+= 【3】


main( )

char str[N];
clrscr( );
printf("/n Input a string:/n");
gets(str);
printf("/n*** original string***/n");
puts(str);
fun(str);
printf("/n*** new string***/n");
puts(str);

更多"数组str全由大小写字母字符组成。请补充函数fun( ),该函数的功能"的相关试题:

[填空题]数组str全由大小写字母字符组成。请补充函数fun( ),该函数的功能是:把str中的字母转换成紧接着的下一个字母,如果原来的字母为‘z’或‘Z’,则相应地转换成‘a’或‘A’,结果仍保存在原数组中。 例如,输入“StudentZz”,则输出“TuvefouAa”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 80 void fun(char s[]) { int i; for(i=0; 【1】 ;i++) { if(s[i]==’z’||s[i]=’Z’) s[i]-= 【2】 ; else s[i]+= 【3】 ; } } main( ) { char str[N]; clrscr( ); printf("/n Input a string:/n"); gets(str); printf("/n*** original string***/n"); puts(str); fun(str); printf("/n*** new string***/n"); puts(str); }
[填空题]请补充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中。请补充函数fun( ),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。
例如,输入“acegikm”,输出“aCeGiKm”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun (char s[])

int i=0;
while ( 【1】 )

if (i%2!=0)
s[i]-= 【2】 ;
【3】 ;


main ( )

char str [N];
clrscr ( );
printf("/n Input a string:/n");
gets (str);
printf("/n*** original string ***/n");
puts (str);
fun (str);
printf ("In*** new string ***/n");
puts (str);

[填空题]从键盘输入一组小写字母,并保存在字符数组str中。请补充函数fun( ),该函数的功能是:把字符数组str中ASCII码为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。 例如,输入“abcdefg”,输出“AbCdEfG”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 80 void fun(char s[]) { int i; for( 【1】 【2】 ;i++) { if( 【3】 ) s[i]-=32; } } main( ) { char str[N]; clrscr( ); printf("/n lnput a string:/n"); gets(str); printf("/n*** original string ***/n"); puts (str); fun (str); printf("/n*** new string ***/n"); puts (str); }
[简答题]填空题 请补充函数fun( ),该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。例如:当n=13572468时,str=“86427531”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #define N 80 char str[N]; void fun(long int n) { int i=0; while(【1】) { str[i]=【2】; n/=10; i++; } 【3】; } main( ) { long int n=13572468; clrscr( ); printf("*** the origial data ***/n"); printf("n=%ld",n); fun(n); printf("/n%s",str); }
[填空题]请补充函数fun( ),该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。例如:当n=13572468时,str=-“86427531”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#include <conio.h>
#define N 80
char str[N];
void fun(long int n)

int i=0;
while( 【1】 )

str[i]= 【2】
n/=10;
i++;

【3】

main( )

long int n=13572468;
clrscr( );
printf("*** the origial data ***/n");
printf("n=%ld",n);
fun(n);
printf("/n%s",str);

[填空题]下面fun函数的功能是将形参x的值转换成二进制数,所得二进制数的每一位数放在数组中返回,二进制数的最低位放在下标为0的元素中,其他依此类推。请填空。
Fun(int x,int b[])
int k=0,r;
do
r=x%2;
______=r;
x/=2;
while(x);

[填空题]下面的函数fun的功能是将形参x的值转换成二进制数,所得二进制数的每一位放在一维数组中返回,二进制的最低位放在下标为0的元素中,其他依次类推,请填空。 fun(int x,int b[]) { int k=0,r; do { r=x% 【13】 ; b[k++]=r; x/= 【14】 ; }while(x);}
[填空题]请补充函数fun( ),该函数的功能是:删去一维数组中所有相同的数,使之只剩一个。数组中的数已按由小到大的顺序排列,函数返回删除后数组中数据的个数。 例如,若一维数组中的数据是:1,1,1,2,2,2,3, 4,4,5,5,6,6,7,7,8,9,9,10,10。 删除后,数组中的内容应该是:1,2,3,4,5,6,7, 8,9,10。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 80 int fun(int a[],int n) { int i, t,j=0; t=a[0]; for(i=1;i<n;i++) if( 【1】 ) ; else { 【2】 ; t=a[i]; } a[j++]=t; return j; } main( ) { int a[N]={1,1,2,2,2,3,4,4,5,5,6,6,6, 7,7,8,9,9,10,10},i,n=20; printf("The original data:/n"); for(i=0; i<n; i++) printf("%4d",a[i]); n=fun(a,n); printf("/n/nThe data after deleted ; /n"); for (i=0;i<n;i++) printf("%4d",a[i]); printf("/n"); }
[填空题]请补充函数fun( ),该函数的功能是把数组bb中的数按从小到大的排列(数组的值及元素个数从土函数中输入)。
例如,输入2 3 5 4 1,结果为1 2 3 4 5。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )吧的横线上填入所编写的若干表达式或语句。
试题程序:
# include<stdio. h>
# define N 100
void fun(int bb[], int n)

int i,j,t;
for (i=0; 【1】 ;i++)
for(j=0; 【2】 ;j++)
if(bb[j]>bb[j+1] )

t=bb[j];
bb [j]=bb [j+1];
bb[j+1]=t;


main( )

int i=0, n=0;
int bb[N];
clrscr ( );
printf("/nInput n: /n");
scanf ("%d", &n);
printf ("/nInput data: /n");
while (i<n)

printf ("bb [%d] =", i);
scanf ("%d", &bb [i]);
i++;

fun (bb, n);
printf("/n*** the result ***/n");
for (i=0; i<n; i++ )
printf ( "%4d’’, bb [i]);

我来回答:

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

订单号:

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