abcdefg#
abcdefg
abcdefg##
##
第1题:
已知字符A的ASCII代码值为65,以下程序运行时若从键盘输入:B33<回车>,则输出结果是【 】。
include
main()
{ char a, b;
a=getchar(); scanf("% d", &b);
a=a-'A'+'0'; b=b*2;
printf("% c % c\n", a, b);
}
第2题:
在执行以下程序时,如果从键盘上输入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.ABCdef
B.abcDEF
C.abc
D.DEF
第3题:
当执行以下程序时,输入 1234567890< 回车 > ,则其中 while 循环体将执行 【 7 】 次。
# include <stdio.h>
main( )
{ char ch;
w hile((ch=getchar( ))== '0') printf("#");
}
第4题:
当执行以下程序时,输入1234567890<回车>,则其中while循环体将执行【 】次。
include<stdio.h>
main()
{ char ch;
while((ch=getchar())=='0')prinft("");
}
第5题:
有以下程序:#include<stdio.h>#include<stdio.h>main() { char c[6]; int i=0; for(;j<6;c[i]=getchar(),i++); for(i=0;i<6;i++)putchar(c[i]); printf("\n");}如果从键盘上输入:ab<回车>c<回车>def<回车>则输出结果为 ______。
A.a b c d e f
B.a b c d
C.ab c d
D.abcdef
第6题:
当输入为"Fool&Swalow"时,下面程序的执行结果是( )。 #include<stdio.h> main() {char c; while(c!='?') { c=getchar(); putchar(C); } }
A.Swalow
B.Fool
C.Fool?
D.?Swalow
第7题:
执行下面的程序时,输入abc<CR>(其中CR代表回车),输出结果是( )。 #include<stdio.h> #include <string.h> main() { char ch; while((cn=getchar())!='n') { switch(ch-'a') { case 0: putchar(ch+1); case 1:putchar(ch+1);break; case 2:putchar(ch+2); caSe 3:putchar(ch+2);break; } } }
A.abc
B.bbc
C.abcd
D.bbcee
第8题:
下列程序运行时,若输入labced12df<回车> 输出结果为【10】
#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++;putchar(ch);
}
printf(“\n”);
}
(10)1AbCeDf2dF
第9题:
已知字符A的ASCII代码值为65,以下程序运行时,若从键盘输入:B33<回车>。则输出结果是______。 #include "stdio.h" main() { char a,b; a=getchar();scanf("Xd",&b); a=a-'A'+'0';b=b*2; printf("%c%c\n",a,b); }
A.2 B
B.1 B
C.3 B
D.4 B
第10题:
有以下程序: #include<stdio.h> main(){ char c[6]; int i=0; for(;i<6;c[i]=getchar(),i++); for(i=O;i<6;i++)putchar(c[i]); printf("\n"); } 如果从键盘上输入: ab<回车> c<回车> def<回车> 则输出结果为_______。
A.a
B.a
C.ab
D.abcdef b b c c c d d d e f