3、输入一个字符,如果是大写字母,则把其变成小写字母;如果是小写字母,则变成大写字母;其它字符不变。请在()内填入缺省的内容。 #include<stdio.h> int main() { char ch; scanf("%c",ch); if(________) ch=ch+32; else if(ch>='a'ch<='z') ch=ch-32; printf("%c\n",ch); }A.ch>='A'||ch<='Z'B.ch>=Ach<=ZC.ch>='A'ch<='Z'D.ch>=A||ch<=Z

3、输入一个字符,如果是大写字母,则把其变成小写字母;如果是小写字母,则变成大写字母;其它字符不变。请在()内填入缺省的内容。 #include<stdio.h> int main() { char ch; scanf("%c",&ch); if(________) ch=ch+32; else if(ch>='a'&&ch<='z') ch=ch-32; printf("%c\n",ch); }

A.ch>='A'||ch<='Z'

B.ch>=A&&ch<=Z

C.ch>='A'&&ch<='Z'

D.ch>=A||ch<=Z


参考答案和解析
c>=’A’ && c<=’Z’

相关考题:

下列程序运行时,若输入labced12df回车 输出结果为【10】#include stdio.hmain( ){char a =0,ch;while((ch=getchar())!=’\n’){if(a2!=0(ch’a’ch=’z’)) ch=ch-‘a’+’A’;a++;putchar(ch);}printf(“\n”);}

下列程序运行时 , 若输入 labcedf2df 回车 输出结果为【 1 0 】#include stdio.hmain(){ char a=0,ch;while((ch=getch ar ())!='\n'){ if(a%2!=0(ch='a'ch='z')) ch=ch-'a'+'A';a++; putchar(ch);}printf("\n");}

3下列程序中,若从键盘中输入的是大写字母C,则程序输出的结果是( )。import java.io.*;public class Exam{public static void main(String args[]){ int ch=0; System.out.println("输入一个字符:"); try{ ch=System.in.readO; char ch_A='A', ch_ Z='Z'; int delta_c=(int)ch_A +(int)ch_Z-ch; System.out.println("编码后的字符为: "+(char)delta_c); } catch(IOException e){ e.printStackTrace(); } }}A.CB.YC.XD.字母C的ASCII码的整型值

下列程序的功能是:求出ss所指字符串中指定字符的个数,并返回此值。例如,若输入字符串123412132,输入字符1,则输出3,请填空。#include#include#define M 81int fun(char *ss, char c){ int i=0;for(; ( );ss++)if(*ss==c)i++;return i;}main(){ char a[M], ch;clrscr();printf("\nPlease enter a string: "); gets(a);printf("\nPlease enter a char: "); ch=getchar();printf("\nThe number of the char is: %d\n", fun(a,ch));}

杭电2000 ASCII码排序 #includestdio.h#includestring.hint main(){ int n,ch[3],i,t,k,j; while(scanf("%d", for(i=0;i3;i++) { if(ch[i]ch[0]) { t=ch[0]; ch[0]=ch[i]; ch[i]=t; } } if(ch[2]ch[1]) { k=ch[2]; ch[2]=ch[1]; ch[1]=k; } for(j=0;j3;j++) { if(j==0) printf("%c",ch[0]); else printf(" %c",ch[j]); } printf("\n"); } return 0;}Problem Description输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。 Input输入数据有多组,每组占一行,有三个字符组成,之间无空格。 Output对于每组输入数据,输出一行,字符中间用一个空格分开。 Sample Inputqweasdzxc Sample Outpute q wa d sc x z

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80int fun (char s[],char ch){int i=0, n=0;while(【 】){if(【 】)n++;i++;}【 】;}main ( ){int n;char str[N], ch;clrscr ();printf ("\nInput a string: \n");gets (str);printf ("\nInput a charactor: \n" ;scanf ("%c", ch);n=fun (str, ch);printf("\nnumber of %c:%d", ch, n);}

在执行以下程序时,如果从键盘上输入ABCdef,则输出为______。include main(){char 在执行以下程序时,如果从键盘上输入ABCdef<回车>,则输出为______。#include <stdio.h>main (){ char ch; while ((ch=getchar())!="\n") { if (ch>='A' ch<='B')ch=ch+32; else if (ch>='a' ch<='z')ch=ch-32; printf("%c",ch); } printf("\n");}A.ABCdefB.abcDEFC.abcD.DEF

将小写字母'n'赋值给字符变量ch,正确的操作是( )。A.ch='\n'B.ch=110C.ch="n"D.ch='N'

若输入12345、abc,程序的输出结果为______。 main() { int a; char ch; scanf("%3d,%3c",a,ch); printf("%d,%c",a,ch); }A.123,abcB.123,4C.123,aD.12345,abc

有以下程序:includeunion pw{int i; char ch[2];}a;main(){a.ch[0]=13;a.ch[1]=0;prin 有以下程序: #include<stdio.h> union pw { int i; char ch[2]; }a; main() { a.ch[0]=13;a.ch[1]=0;printf("%d\n",a.i);} 程序的输出结果是( )。A.13B.14C.208D.209

以下程序的输出结果是()。includecharcchar(chareh){if(ch>='A,ch 以下程序的输出结果是( )。 #include <stdio.h> charcchar(char eh) { if(ch>='A,ch<='Z') ch=ch-'A'+'a'; return ch; } main() { char s[]="ABC+abc=defDEF",*p=s; while(*p) { *p=cchsr(*p); p++; } printf("%s\n",s); }A.abc+ABC=DEFdefB.abc+abc=defdefC.abcABCDEFdefD.abcabcdefdef

请编写函数fun(),它的功能是:求出ss所指字符串中指定字符的个数,并返回此值。例如,若输入字符串123412132,输入字符1,则输出3。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<coio.h>include<stdio.h>define M 81int fun(char *ss,char c){}main(){ char a[M],ch;clrscr();printf("\nPlease enter a string:");gets(a);printf("\nPlease enter a char:");ch=getchar();printf("\nThe number of the char is:%d \n",fun(a,ch));}

阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。【说明】给定函数fun的功能是:将从键盘上输入的每个单词的第一个字母转换为大写字母,输入时各单词必须用空格隔开,用“.”结束输入。【函数】int fun(char *c,int status){if((1)=='')return 1;else{if((2)(3)(4))(5)='A'-'a';return 0;}}main(){int flag=1;char ch;printf("请输入一字符串,用点号结束输入!\n");do {ch=getchar();flag=fun(ch,flag);putchar(ch);}while(ch!='.');printf("\n");}

设有如下程序 # include main() { char ch1='A',ch2='a'; printf("%c\n",(ch1,ch2)); } 则下列叙述正确的为( )A. 程序的输出结果为大写字母AB. 程序的输出结果为小写字母aC. 运行时产生错误信息D. 格式说明符的个数少于输出项的个数,编译出错

下列程序的功能是:求出ss字符串中指定字符c的个数,并返回此值。请编写函数int num(*char ss,char c)以实现程序要求,最后调用函数readwriteDat(),把结果输出到文件out.dat中(注:大小写字母有区别)。例如:若输入字符串“ss="123412132" , c=’1’”,则输出“3”。部分源程序已给出。请勿改动主函数main()和输出数据函数writeDat()的内容。#include conio.h#include stdio.h#define M 81void readwriteDAT(); int num(char *ss,char c){ } main(){ char a[M],ch; clrscr(); printf("\nPlease enter a string:" );gets(a); printf("\nPlease enter a char;" );ch=getchar(); printf("\nThe number of the char is:%d\n" ,num(a,ch)); readwriteDAT();}viod readwriteDAT(){ int i; FILE *rf,*wf; char a[M],b[M],ch; rf=fopen("in.dat" ,"r" ); wf=fopen(" out.dat" ,"w" ); for(i=0;i10;i++){ fscanf(rf," %s",a); fscanf(rf," %s" ,b); ch=*b; fprintf(wf," %c=%d\n:" ,ch,num(a,ch));} fclose(rf); fclose(wf);}

下列程序运行时,若输入labcedf2df输出结果为【】。 include main(){char a=0,ch; wh 下列程序运行时,若输入labcedf2df<回车>输出结果为【 】。include<stdio.h>main(){ char a=0,ch;while((ch==getchar())!='\n'){ if(a%2!=0(ch>='a'ch<='z')) ch=ch'a'+'A';a++;prtchar(ch);}printf("\n");}

阅读以下说明和c++码,将应填入(n)处的字名写在对应栏内。[说明] 从键盘输入一个字符ch,输出该字符在文本文件input.txt 的每一行中出现的次数。(必须调用函数鳋统计ch的出现次数,函数ff (str,ch)的功能是统计并返回字符ch在字符串str 中出现的次数。)。例如:如果文件input. txt 中存放了下列数据:every121I am a student运行程序,并输入e后,输出:201int ff( char * str, char ch){ int count =0;while ((1)) {if( *str= =ch) count++;str ++;}return count;}include < stdio. h >include < stdlib. h >void main( ){ char ch, c, s [80];int k;FILE *fp;if((2)){printf( “打不开文件!n”); return;}ch = getchar( );k=0;while( ! feof(fp) ) {c = fgete(fp);if (3)s[k++ ] =c;else {s[k]= ";printf ( "%dn" ,ff(s, ch) );k=0;}}(4)printf( "% dn", ff( s, ch ) );}

请补充函数fun(),该函数的功能是;删除字符数组中小于等于指定字符的字符,指定字符从键盘输入,结果仍保存例如,输入“abcdefghij”,指定字符为‘d’,则结果输出“defghij”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio. h>define N 80void fun (char s[], char ch){int i=0, j=0;while (s [i] ){if (s Iii<ch)【 】;else{【 】i++;}}【 】}main (){char str [N], ch;clrscr ();printf("\n Input a string:\n");gets (str);printf("\n*** original string ***\n");puts (str);printf("\n Input a character:\n");scanf ("%c", ch);fun(str, ch);printf("\n*** new string ***\n");puts (str);}

运行下面程序时,从键盘输入字母H,则输出结果是includemain(){ char ch;ch=getchar();s 运行下面程序时,从键盘输入字母H,则输出结果是 #include<stdio.h> main() { char ch; ch=getchar(); switch(ch) { case 'H':printf("Hello!\n"); case 'G':printf("Good morning!\n"); default:printf("Bye_Bye!\n"); } }A.Hello!B.Hello! GoodMoring!C.Hello! Goodmorning! Bye_Bye!D.Hello! Bye_Bye!

有以下程序: include main() {char ch1,ch2;int n1,n2;ch1=getchar();ch2=getehar();n1 有以下程序:include <stdio.h>main(){ char ch1,ch2;int n1,n2;ch1=getchar();ch2=getehar();n1=ch1-'0'; n2=n1*10+(ch2-'0');printf("%d\n",n2);}程序运行时输入:12<回车>,执行后的输出结果是【 】。

下面程序中,若从键盘输入大写字母C,则程序的输出结果是______。 import java.io.*; public class Test{ public static void main(String args[ ]){ int ch=0; System.out.println("Please input a character:"); try{ ch=System.in.read( ); char ch_A='A',ch_Z='Z'; int delta_c=(int)ch_A+(int)ch_Z-ch; System.Out.println("the encoded character is:"+(char)delta_C); }catch(IOException e){e.printStackTrace( );} } }A.CB.YC.XD.字母C的ASCII码的整型值

下列程序中,若从键盘中输入的是大写字母C,则程序输出的结果是( )。 Importjava.io.*; public class Exam{ public static void main(String args[]){ int ch=0; System.out.println("输入一个字符:"); try{ ch=System.in.read; charch_A='A',ch_Z='Z'; int delta c=(int)ch A+(int)ch Z-ch; syStem. out.println("编码后的字符为:"+(char)delta_c); } catch(IOException e){ printStackTrace; } } }A.CB.YC.XD.字母C的ASCIl码的整型值

有以下程序:includeunion pw{int i; char ch[2]; } a;main(){a.ch[0]=13; a.ch[1]=0; 有以下程序: #include <stdio.h> union pw { int i; char ch[2]; } a; main() { a.ch[0]=13; a.ch[1]=0; printf("%d\n",a.i); } 程序的输出结果是(注意:ch[0]在低字节,ch[1]在高字节)( )。A.13B.14C.208D.209

设ch是char型变量,其值为'A',则下面表达式的值是( )。 ch=(ch>='A'ch<='Z')? (ch+32):chA.AB.aC.ZD.z

在执行以下程序时,如果从键盘上输入:ABCdef,则输出为______。 main() { char ch; while((ch 在执行以下程序时,如果从键盘上输入:ABCdef<回车>,则输出为______。 main() { char ch; while((ch=getchar())!='\n') { if(ch>='A' ch<='Z') ch=ch+32; else if(ch>='a'ch<='2')ch=ch-32; printf("%c",ch); } printf("\n"); }A.ABCdefB.abcDEFC.abcD.DEF

下列程序中,若从键盘中输入的是大写字母C,则程序输出的结果是 import java.io.*; public class Exam{ public static void main(String args[]) int ch=0; System.out.println(”输入一个字符:”); try{ ch=System.in.read(); char ch_A='A',ch_Z='Z',; int delta_c=(int)ch_A+(int)ch_Z-ch; System.out.println(”编码后的字符为:”+(char)delta_c); } catch(IOException e){ e.printStackTrace(); } } }A.CB.YC.XD.字母C的ASCII码的整型值

下列语句应将小写字母转换为大写字母,其中正确的是()。A、if(ch=’a’ch=’z’)ch=ch-32;B、if(ch=’a’ch=’z’)ch=ch-32;C、ch=(ch=’a’ch=’z’)?ch-32:’’;D、ch=(ch’a’ch’z’)?ch-32:ch;

判断char型变量ch是否为小写字母的正确表达式是()A、’a’=ch=’z’B、(ch=’a’)(ch=’z’)C、(ch=’a’)(ch=’z’)D、(’a’=ch)AND(’z’=ch)