试题与答案

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

答案:

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

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

参考答案:错

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