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

[填空题]从键盘输入一组小写字母,并保存在字符数组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);

更多"从键盘输入一组小写字母,并保存在字符数组str中。请补充函数fun( "的相关试题:

[填空题]从键盘输入一组小写字母,保存在字符数组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); }
[填空题]str是全部由小写字母字符和空格字符组成的字符串,由 num传入字符串的长度。请补充函数fun( ),该函数的功能是:统计字符串str中的单词个数,结果由变量num传回。每个单词之间都由空格隔开,并且字符串str开始不存在空格。
例如:str=“how do you do”,结果为:num=4。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(char *s,int *num)

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

if(s[i]>=’a’,&&s[i]<=’z’,&&(s[i+1)==’ ’||s[i+1]==’/0’))
【2】

【3】

main( )

char str[N];
int num=0;
printf("Enter a string:/n");
gets(str);
while(str[num])
num++;
fun(str,&num);
printf("The number of word is:
%d/n/n",num);

[填空题]请补充函数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); }
[单项选择]为进行键盘输入大小写字母转换的控制键是()。
A. CapsLock
B. Shift
C. NumLock
D. Alt
[填空题]请补充main( )函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1="computer",则str2="cmue"。 注意:部分源程序给出如下。 请勿改动函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。 试题程序: #include<stdlib.h> #include<stdio.h> #include<conio.h> #define LEN 80 void main( ) { char str1[LEN],str2[LEN]; char*p1=str1,*p2=str2; int i=0,j=0; system("CLS"); printf("Enter the string:/n"); scanf(______); printf("***the origial string***/n"); while(*(p1+j)) { printf("______",*(p1+j)); j++; } for(i=0;i<j;i+=2) *p2++=*(str1+i); *p2="/0"; printf("/nThe new string is:%s/n",______); }

[填空题]请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则 str2=“cegi”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define LEN 80
main( )

char str1[LEN],str2 [LEN];
char *p1=str1,*p2=str2;
int i=0,j=0;
clrscr( );
printf("Enter the string:/n");
scanf( 【1】 );
printf("***the origial string***/n");
while(*(p1+j))

printf(" 【2】 ",*(p1+j));
j++;

for(i=0;i<j;i+=2)
*p2++=*(str1+i);
*p2=’/0’;
printf("/nThe new string is:%s/n", 【3】 );

[多项选择]填空题 请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则str2=“cegi”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #define LEN 80 main( ) { char str1[LEN],str2[LEN]; char *p1=str1,*p2=str2; int i=0,j=0; clrscr( ); printf("Enter the string:/n"); scanf(【1】); printf("***the origial string***/n"); while(*(p1+j)) { printf("【2】",*(p1+j)); j++; } for(i=0;i
[填空题]数组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是一个由数字和字母字符组成的字符串,由变量num传入字符串长度。请补充函数fun( ),该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。 例如:str=“Bcd123e456hui890”,结果为:123456890。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include #define N 80 int bb[N]; int fun(char s[],int bb[],int num) { int i,n=0; for(i=0;i
[填空题]下列程序段是从键盘输入的字符中统计小写字母的个数,用换行符结束循环。请填空。
int n=0,c;
c=getchar( );
while(c!=’/n’)
if(______)
n++;

[填空题]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]);

[填空题]下列程序段是从键盘输入的字符中统计小写字母的个数,用换行符结束循环。请填空。int n=0,c;c=getchar( );while(c!=’/n’) if(______) n++;

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码