数字字符'0'的ASCII值为48,若有以下程序: #include <stdio.h> main( ) char a='1',b ='2'; printf( "% c,",b + + ); printf(" % d \n" ,b - a); } 程序运行后的输出结果是( )。
A.3,2
B.50,2
C.2,2
D.2,50
第1题:
以下程序用以删除字符串中所有的空格,请填空。
include<stdio.h>
main()
{char s[100]={"Our teacher teach C language!"};int i,j;
for(i=j=0;s[i]!='\0';i++)
if(s[i]!=''){( )}
s[j]='\0';
printf("%s\n",s);
}
第2题:
若有如下程序; main() {char *p="china"; p+=1; printf("%d\n",p); } 则程序运行后的输出结果是 ( )
A.china
B.字符h的地址
C.hina
D.字符h的ASCII码值
第3题:
数字字符0的ASCⅡ值为48,若有以下程序: main() { char a='1',b='2'; printf("%c,",b++); printf("%d\n",b-A); } 程序运行后的输出结果是( )。
A.3,2
B.50,2
C.2,2
D.2,50
第4题:
A.ASCII码值为2的字符
B.ASCII码值为1的字符
C.2
D.1
第5题:
下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
include<stdio.h>
include<ctype.h>
main()
{ char c;
int a,s=0;
while(______)
if(isdigit(c))
{a=c-'0';s+=a;}
printf("s=%d",s);
}
分析题目可知,程序中运用函数c=getchar()从标准输入设备读取下一个字符,而且是一行的字符(即没有换行),所以条件为(c=getchar())!='\n'。
第6题:
有以下程序: #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.13
B.14
C.208
D.209
第7题:
已知字符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
第8题:
数字字符0的ASCII值为48,运行下列程序的输出结果是( )。 main() { char a='1',b='2'; printf("%c,",b++); printf("%d\n",b-A); }
A.3,2
B.50,2
C.2,2
D.2,50
第9题:
数字字符0的ASCII值为48,若有以下程序 main() { char a='1',b='2'; printf("%c,b++); printf("%d\n",b-a); } 程序运行后的输出结果是______。
A.3,2
B.3,1
C.2,1
D.2,2
第10题:
下列程序执行的输出结果是( )。 #include<stdio.h> main() { char a[2][4]; strcpy(a,"are");strcpy(a [1],"you"); a[0][3]='&'; printf("%s\n",a); }
A.are&you
B.you
C.are
D.&