更多"将大写字母转换为小写字母的函数是______。"的相关试题:
[填空题]将大写字母转换为小写字母的函数是______。
[简答题]【说明】
以下程序的功能是:从键盘上输入一个字符串,把该字符串中的小写字母转换为大写字母,输出到文件test.txt中,然后从该文件读出字符串并显示出来。
【程序】
#include < stdio. h >
main( )
FILE * fp;
char str[100]; int i=0;
if((fp=fopen("text.txt" (1) )) ==NULL)
printf("can’t open this file. /n") ;exit(0) ;
printf(" input astring: /n" ); gest(str);
while( str[i] )
if(str[i] >=’a’ && str[i] <=’z’)
str[i]= (2) ;
fputc(str[i], (3) );
i++;
fclose(fp);
fp=fopen(" test.txt", (4) );
fgets(str, 100, fp);
printf("%s/n" ,str);
(5) ;
[单项选择]已知大写字母A的ASCII码是65,小写字母a的ASCII码是97。以下不能将变量c中的大写字母转换为对应小写字母的语句是______。
A. c=(’A’+c)%26-’a’
B. c=c+32
C. c=c-’A’+’a’
D. c=(c-’A’)%26+’a’
[简答题]填空题
请补充main函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。
例如:当str[N]=“123 abcdef ABCDEF!”,结果输出:“123 ABCDEF ABCDEF!”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include
#include
#include
#define N 80
void main( )
{
int j;
char str[N]=" 123abcdef ABCDEF!";
char *pf=str;
clrscr( );
printf("***original string ***/n");
puts(str);
【1】;
while(*(pf+j))
{
if(*(pf+j)>=’’a’’&&*(pf+j)<=’’z’’)
{
*(pf+j)=【2】;
j++;
}
else
【3】;
}
printf("******new string******/n");
puts(str);
system("pause");
}
[填空题]请补充main函数,该函数的功能是:把一个字符串中的所有小写字母字符全部转换成大写字母字符,其他字符不变,结果保存原来的字符串中。
例如:当str[N]“123 abcdef ABCDEF!”,结果输出:
“123ABCDEFABCDEF!”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define N 80
void main( )
int j;
char str[N]="123abcdef ABCDEF!";
char *pf=str;
clrscr( );
printf("*** original string ***/n");
puts(str);
【1】 ;
while(*(pf+j)).
if(*(pf+j)>=’a’&&* (pf+j)<=’z’)
*(pf+j)= 【2】 ;
j++;
else
【3】 ;
printf("****** new string ******/n");
puts(str);
system("pause");
[填空题]请补充函数proc( ),该函数的功能是将字符串str中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“How Are You”,则输出“how are you”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char *proc(char str[])
int i;
for(i=0; str[i]; i++)
if((str[i]>=’A’)&&( (1) )
(2) ;
return( (3) );
void main( )
char str[81];
printf("/nPlease enter a string: ");
gets(str);
printf("/nThe result string is: /n%s",
proc(str));
[填空题]请补充函数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));
[填空题]下列给定程序中,函数fun( )的作用是,将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入"Ab,cD",则输出"ab, cd"。
请改正函数fun( )中的错误,使它能得出正确的结果。
注童:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <string.h>
#include <conio.h>
char *fun (char tt[])
int i;
for(i=0; tt[i]; i++)
/**************found**************/
if((’A’ <=tt[i]||(tt[i]<=’z’ ))
tt[i]+=32;
return(tt);
main( )
int i;
char tt[81];
clrscr( );
printf("/nPlease enter a string:");
gets(tt);
printf("/nThe result string is:/n %s",
fun(tt));
[填空题]下列给定程序中函数fun的功能是:将tt所指字符串中的小写字母全部改为对应的大写字母,其他字符不变。
例如,若输入“Ab,cD”,则输出“AB,CD”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<conio.h>
#inctude<stdio.h>
#include<string.h>
char*fun(char tt[])
int i;
for(i=0;tt[i];i++)
/*********found*********/
if((tt[i]>=’a’)||(tt[i]<=’z’))
/*********found*********/
tt[i]+=32;
return(tt);
void main( )
char tt[81];
printf("/nPlease enter a string:");
gets(tt);
printf("/nThe result string is:%s/n",fun(tt);