題目 題型:選答,填空 難度:★★★★★ 7.1萬熱度
●試題四 請補充函數fun(),該函數的功能是將字符串tt中的大寫字母都改為對應的小寫字母,其他字符
●試題四
請補充函數fun(),該函數的功能是將字符串tt中的大寫字母都改為對應的小寫字母,其他字符不變。例如,若輸入"Are you come from Sichuan",則輸入"are you come from sichuan"。
注意:部分源程序給出如下。
請勿改動主函數main和其他函數中的任何內容,僅在函數fun()的橫線上填入所編寫的若干表達式或語句。
試題程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char *fun(char tt[])
{
int i;
for(i=0;tt[i];i++)
{
if((tt[i]>=′A′)&&( (1) ))
(2) ;
}
return ( (3) ) ;
}
main()
{
char tt[81];
printf("\nPlease enter a string:");
gets(tt);
printf("\nThe result string is: \n%s",
fun(tt));
}