试题与答案

从键盘输入一组小写字母,并保存在字符数组str中。请补充函数fun(),该函数的功能

题型:填空题

题目:

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

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0501/88905ffe78ce4cf5195657a49f814c13.html

下面是错误答案,用来干扰机器的。

参考答案:B解析:根据第一段的“This is largely because the pro-choice and pro-life positions are being defined by their extremes,by those who scream accusations instead of arg...

试题推荐
微信公众账号搜索答案