下列程序运行时,若输入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");
}
第1题
有以下程序
include<stdio.h>
main()
{ char c1,c2;
scanf("%c",*c1);
while(c1<65||c1>90) scanf("%c",&c1);
c2=c1+32;
printf("%c,%c\n",c1,c2);
}
程序运行输入6回车后,自否输出结果、结束运行(请回答能或不能)【 】。
第2题
下面程序的输出结果是______。
main()
{ static char a[]="language",b[]="program";
char *ptrl=a,*ptr2=b;
int k
for(k=0;k<7;k++)
if(*(ptrl+k)==*(ptr2+k))
printf("%c",*(ptr1+k));}
第3题
以下程序运行后的输出结果是 。
inc]udc
main()
{int x=10.y=20.t=0;
if(x==y) t=x;x=y;y=1;
printf(“%d %d/n”.x,y);
第4题
有以下程序(说明:字符0的ASCII码值为48)
include
main()
{char cl,c2;
scanf(“%d”,&c1);
’ c2=cl+9:
prinif(“%c%c\n”,cl,c2);
}
若程序运行时从键盘输入48<回车>,则输出结果为 。
第5题
是:把 str字符串转换成任意进制的数,结果保存在数组xx中,由函数返回转换后数组腆的实际长度。其中x表示str原来的进制, y表示要转换成的进制。例如,输入str=“1111”,x=2,y=10,结果输出:15。如果输入str=“15”, x=10,Y=2,结果输出: 1111。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
include <stdio.h>
include<stdlib.h>
include<string.h>
define N 8
int xx[N];
int fun(char *str,int x,int y)
{
int sum;
int i=0;
char *p=str;
for(i=0; i<N; i++)
xx[i]=0;
sum=*p-'0';
p++;
while (*p)
{
sum=【 】;
p++;
}
i=0;
while(sum!=0)
{
xx[i]=【 】;
【 】;
i++;
}
return i;
}
main ()
{
char str[6];
int i;
int n;
int x;
int y;
printf("Enter a string made up of '0' to
'9' digits character:");
gets(str);
if(strlen (str) >5)
{
printf("Error:string too longer!,
please input again!\n\n");
exit(0);
}
for(i=0;str[i];i++)
if(str[i]<'0'||str[i]>'9')
{
printf("Error:%c not is '0' to
'9' digits character!\n\n",
str[i]);
exit(0);
}
printf("The original string: ");
puts(str);
printf("\nINPUT x= ");
scanf("%d",&x);
printf("\nINPUT y= ");
scanf("%d",&y);
n=fun(str,x,y);
printf("\n%s is convered to",str);
for (i=n-1; i>=0; i--)
printf("%d",xx[i]);
}
第6题
执行以下程序后,输出''号的个数是【 】。
include
main()
{ int i,j;
for(i=1; i<5; i++)
for(j=2; j<=i; j++) putchar('');
}
第8题
下列程序段的运行结果是______。
int x=0,y=0;
while(x<15) y++,x+=++y;
pfintf("%d,%d",y,x);
第9题
下列程序的输出结果是______。
include<stdio.h>
main()
{ int a=2,b= 1,c=2;
if(a<b)
if(b<0) c=0;
else c++;
printf("%d\n",c);
}
第10题
有以下程序
include<stdio.h>
main( )
{int n[2l,ij;
for(i=0;i<2;i++)n[i]=0;
for(i=0;i<2;i++)
for(j=0;j<2;j++)n[j]=n[i]+1;
printf(”%d\n”,n[1]);
}
程序运行后的输出结果是________ 。
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!