单选题有以下程序#includecharfun(char*c){ if(*c='Z'*c='A') *c-='A'-'a'; return*c;}main(){ chars[81],*p=s; gets(s); while(*p) { *p=fun(p); putchar(*p); p++; } printf();}若运行时从键盘上输入OPENTHEDOOR回车,程序的输出结果是( )。AOPEN THE DOORBOPEN tHE dOORCopen the doorDOpen The Door
单选题
有以下程序
#include
char fun(char *c)
{
if(*c<='Z'&&*c>='A')
*c-='A'-'a';
return *c;
}
main()
{
char s[81],*p=s;
gets(s);
while(*p)
{
*p=fun(p);
putchar(*p);
p++;
}
printf();
}
若运行时从键盘上输入OPEN THE DOOR<回车>,程序的输出结果是( )。
A
OPEN THE DOOR
B
OPEN tHE dOOR
C
open the door
D
Open The Door
参考解析
解析:
在ASCII码表中,同一字母的小写编码比大写编码大32。fun函数中对大字字母执行*c-= 'A'-'a',即*c = *c-(-32),把*c从大写变成了小写。该程序的功能就是先将数组s中的大写字符转变为小写字符,然后输出s。答案选择C选项。
在ASCII码表中,同一字母的小写编码比大写编码大32。fun函数中对大字字母执行*c-= 'A'-'a',即*c = *c-(-32),把*c从大写变成了小写。该程序的功能就是先将数组s中的大写字符转变为小写字符,然后输出s。答案选择C选项。
相关考题:
阅读下面程序段,则执行后输出的结果是#include "stdio.h"main(){ char fun(char,int);char a=′A′;int b=13;a=fun(a,b);putchar(a);}char fun(char a,int b){char k;k=a+b;return k;}A.AB.MC.ND.L
有以下程序:includevoid fun(char *c,intD){*c=*c+1;d+=1;printf("%c,%c",*c,D;}main( 有以下程序: #include<stdio.h> void fun(char *c,intD){ *c=*c+1; d+=1; printf("%c,%c",*c,D;} main() { char a='F',b='f'; fun(b,A); printf("%c,%c\n",a,B);} 程序的输出结果为( )。A.g,GF,gB.g,FF,gC.G,fF,GD.f,gf,g
有以下程序:includevoid fun(char**p){++P;printf("%s\n",*p);}main()char*a[]={"Morn 有以下程序: #include<stdio.h> void fun(char**p) { ++P;printf("%s\n",*p);} main() char*a[]={"Morning","Afternoon","Evening","Night"}; fun(A); } 程序的运行结果是( )。A.AfternoonB.fternoonC.MorningD.oring
有以下程序: include using namespace std; constxntN=5; int fun(char*s,char a,int 有以下程序:include <iostream>using namespace std;const xnt N=5;int fun(char *s,char a,int n){int j;*s=a;j=n;while(a<s[j])j--;return j;}int main(){char s[N+1];int k;
有以下程序: include point ( char * p) {p + = 3; }main( ) char b[4] = {'a','b','c 有以下程序: #include <stdio.h>point ( char * p) { p + = 3; }main( ) char b[4] = {'a','b','c','d'} , *p=b; point(p); printf( "% c \n" , * p);A.aB.bC.cD.d
有以下程序 include int fun(char s[]) { int n=O; whil 有以下程序 #include <stdio.h> int fun(char s[]) { int n=O; while(*s<='9'*s>='0') { n=10*n+*s-'0'; s++; } return (n); } main() { char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'}; printf("%d\n",fun(s)); }A.9B.61490C.61D.5
有以下程序: include void funl (char * p){char * q; q=p; while( *q! ='\0') } (*q) 有以下程序: #include <stdio.h>void funl (char * p){ char * q; q=p; while( *q! ='\0') } (*q) ++;q++;}mains( ){ char a[ ] = { "Program" } , * p; p = a[3]; fun1 (p); printf("% s \n" ,a);}程序执行后的输出结果是( )。A.ProhsbnB.PrphsbnC.ProgsbnD.Program
有以下程序 include void fun(char **p) { ++p; printf("%s\n",*p); 有以下程序 #include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[]={"Moming","Afternoon","Evening","Night"}; fun(a); } 程序的运行结果是A.AfternoonB.fternoonC.MorningD.orning
有以下程序 include void fun(char *t, char *s) { whil 有以下程序 #include <stdio.h> void fun(char *t, char *s) { while(*t!=0) t++; while( (*t++ = *s++ )!=0 ); main() { char ss[10]="acc",aa[10]="bbxxyy"; fun(ss, aa); printff"%s,%s\n", ss,aa); 程序的运行结果是A.accxyy, bbxxyyB.acc, bbxxyyC.accxxyy, bbxxyyD.accbbxxyy, bbxxyy
有以下程序:includevoid fun(char *a,char*B){while(*a=='*')a++;while(*b=*A){b++;a+ 有以下程序: #include<stdio.h> void fun(char *a,char*B){while(*a=='*')a++; while(*b=*A){b++;a++;} } main() {char*s="****a*b****",t[80]; fun(s,t);puts(t); } 程序的运行结果是( )。A.*****a*bB.a*bC.a*b****D.ab
以下程序的输出结果是【 】。includeincludechar*fun(char*0{ char *p--t;retur 以下程序的输出结果是【 】。include <stdio.h>include <string.h>char *fun(char *0{ char *p--t;return (p+strlen(t)/2);}main(){ char *str="abcdefgh";str=ftm(str);puts(str);}
有下列程序:includevoid fun(char *a, char *B){while(*a=='*')a++;while(*b=*A){b++; 有下列程序: #include <stdio.h> void fun(char *a, char *B) { while(*a=='*')a++; while(*b=*A) {b++;a++;} } main() { char *s="*****a*b****",t[80]; fun(s,t);puts(t); 程序的运行结果是( )。A.*****a*bB.a*bC.a*b****D.ab
有以下程序#include stdio.hvoid fun( char. c){ if(c'x') fun( c-1);printf("%c",c);}main( ){ fun(’z’); }程序运行后的输出结果是A) xyzB) wxyzC) zyxwD)zyx
请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值
有以下程序:include fun( char p[] [10]){int n=0,i; for(i=0;i 有以下程序:#include <stdio.h>fun( char p[] [10]){ int n=0,i; for(i=0;i<7;i ++) if(p[i][0] =='T') n++; return n;}main( ){ char sir[] [10] = { "Mon" ,"Tue" ,"Wed" ,"Thu" ,"Fri" ,"Sat" ,"Sun" }; prlnff(" % d\n" ,fun(str) );}程序执行后的输出结果是( )。A.1B.2C.3D.0
下列程序输出的结果是()。includeun1(char a,char b){char c;c=a;a=b;b=c;}fun2(char*a 下列程序输出的结果是( )。 #include<stdio.h> un1(char a,char b){char c;c=a;a=b;b=c;} fun2(char*a,char b){char c;c=*a;*a=b;b=c;} fun3(char*2,char*b){charc;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B';funl(a,b);putchar(a);putchar(b);A.BABBABB.ABBBBAC.ABBABAD.ABABBA
请读程序: includeChar fun(char*c)(if(c='A') * c-='A'-'a'ret 请读程序: # include<stdio.h> Char fun(char*c) (if(c<='z' * c>='A') * c-='A'-'a' return * c; } main() { char s[81],* p=s; gets(s); while(* p) { * p=fun(p);putchar(* p);p + +; puchar('\n'); } 若运行时从键盘上输入OPEN THE DOOR <CR>(<CR>表示回车),则上面程序的输出结果是 ( )A.oPEN tHE dOORB.ope the doorC.OPEN THE DOORD.Open The Door
下列程序输出的结果是()。includefun1(char a,char b){char c;c=a;a=b;b=c;}fun2(char* 下列程序输出的结果是( )。 #include<stdio.h> fun1(char a,char b){char c;c=a;a=b;b=c;} fun2(char*a,char b){char c;c=*a;*a=b;b=c;} fun3(char*a,char*b){char c;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B';fun1(a,b);putchar(a);putchar(b); a='A';b='B';fun2(a,b);putchar(a);putchar(b); a='A';b='B';fun3(a,b);putchar(a);putchar(b); putchar('\n'); } A) B)C) D)A.BABBABB.ABBBBAC.ABBABAD.ABABBA
有以下程序 include void fun(char *t,char *s) { while(*t!=0) t++; while((*t++=*s 有以下程序#include <stdio.h>void fun(char *t,char *s){ while(*t!=0) t++;while((*t++=*s++)!=0);}main( ){ char ss[10]="acc",aa[10]="bbxxyy";fun(ss,aa); printf("%s,%s\n",ss,aa);}程序的运行结果是A.accxyy,bbxxyyB.acc,bbxxyyC.accxxyy,bbxxyyD.accbbxxyy,bbxxyy
有以下程序:include char fun(char x,char y){if(x 有以下程序: #include <stdio.h> char fun(char x,char y) { if(x<y) return x; return y; } main() { int a='9',b='8',c='7'; printf("%c\n",fun(fun(a,b),fun(b,c))); } 程序的执行结果是( )。A.函数调用出错B.8C.9D.7
有以下程序: include void fun(char(*p)[6]) { int i; for(i=0;i 有以下程序: #include void fun(char(*p)[6]) { int i; for(i=0;iA.Aa1FB.Ab3IC.ABCDD.fghij
有以下的程序includevoid fun(char*fname,char*st){FILE*myf;inti; myf=fopen(fname," 有以下的程序 #include<stdio.h> void fun(char *fname,char *st) { FILE *myf; int i; myf=fopen(fname,"w"); for(i=0;i<strlen(st);i++)fputc(st[i],myf); fclose(myf); } main() { fun("test.t","new world");fun("test.t","hello,");} 程序执行后,文件test.t中的内容是( )A.hello,B.new worldhello,C.new worldD.hello,rld
有以下程序:includevoid fun(char *a, char *b){ a=b;(*a)++;}main(){char c1='A',c2= 有以下程序: #include <stdio.h> void fun(char *a, char *b) { a=b; (*a)++;} main() { char c1='A',c2='a',*p1,*p2; p1=c1; P2=c2; fun(p1,p2); printf("%c%c\n",c1,c2); } 程序运行后的输出结果是( )。A.AbB.aaC.AaD.Bb
下列程序输出的结果是( )。 include fun1(char a,char b) {char c;c=a;a=b;b=c;} fun2 下列程序输出的结果是( )。 #include<stdio.h> fun1(char a,char b) {char c;c=a;a=b;b=c;} fun2 (char*a,char b) {char c;c=*a;*a=b;b=c;} fun3(char*a,char*b) {char c;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B'; fun1 (a,b);putchar(a);putchar(b); a='A';b='B'; fun2 (a,b);putchar(a);putchar(b); a='A';b='B'; fun3 (a,b);putchar(a);putchar(b); putchar('\n'); }A.BABBABB.ABBBBAC.ABBABAD.ABABBA
有以下程序:includeint fun(char s[]){ intn=0;while(*s='0'){n=10 有以下程序: #include <stdio.h> int fun(char s[]) { int n=0; while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;} return(n); } main() { char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d\n",fun(s)); } 程序的运行结果是( )。A.9B.61490C.61D.5
下面程序输出的结果是()。includemain(){char *a="1234";fun(a);printf("\n");}fun(cha 下面程序输出的结果是( )。 #include<stdio.h> main() { char *a="1234"; fun(a); printf("\n"); } fun(char *s) { char t; if(*s) { t=*S++;fun(s);} else return; if(t!='\0') putchar(t); }A.1234B.4321C.1324D.4231
以下程序的输出结果是【 】。includeincludechar*fun(char*t){ char *p=t;retur 以下程序的输出结果是【 】。include <stdio.h>include <string.h>char *fun(char *t){ char *p=t;return (p+strlen(t)/2);}main(){ char *str="abcdefgh";str=ftm(str);puts(str);}
(29)有以下程序include stdio.hvoid fun(char *c){ while(*c){ if(*c='a'stdio.hvoid fun(char *c){ while(*c){ if(*c='a'*c='z') *c=*c-('a'-'A');c++;}}main(){ char s[81];gets(s); fun(s); puts(s):}当执行程序时从键盘上输入Hello Beijing回车,则程序的输出结果是A)hello beijingB)Hello BeijingC)HELLO BEIJINGD)hELLO Beijing