相关题目
有以下程序
#include
void main()
{ int s;
scanf("%d",&s);
while(s>0)
{ switch(s)
{ case 1:printf("%d",s+5);
case 2:printf("%d",s+4); break;
case 3:printf("%d",s+3);
default:printf("%d",s+1);break;
}
scanf("%d",&s);
}
}
运行时,若输入1 2 3 4 5 0<回车>,则输出结果是( )。
#include
void main()
{
char str[]="\"stop!\",he said";
printf(str);
}
程序的运行结果是 ( )。
#include
int streql(char *str1,char *str2)
{ while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
void main()
{
printf("%d",streql("abc","Abc"));
}
程序的运行结果是 ( ) 。
#include "stdio.h"
void main( )
{ char str[80];
scanf("%s",str);
insert(str);
}
insert(char s[])
{
int i;
for(i=strlen(s);i>0;i--)
{ s[2*i]=s[i];
s[2*i-1]=' ';
}
printf("%s",s);
}
如果输入的字符串是abcd, 则程序的运行结果是 ( ) 。
#include "stdio.h"
int digits(int n)
{
int c=0;
do {
c++;
n/=10;
}while(n);
return c;
}
void main( )
{
printf("%d",digits(824));
}
程序运行结果是 ( ) 。
#include
void disp(char *string)
{
if(*string)
{
disp( string+1);
putchar (*string);
}
}
void main()
{
disp("abcdefg");
}
程序的运行结果是( )。
#include "stdio.h"
void main()
{
int a=2,i=0,tn=0,sn=0;
while(i<3)
{
tn=tn+a;
sn=sn+tn;
a=a*10;
i++;
}
printf("%d",sn);
}
程序的运行结果是( )。
要使下列程序的输出结果是字符A,则下划线处应填 ( ) 。
main()
{
char x='b';
int i=0;
do{
--x;
}while( _____ );
printf("%c",x);
}
下列程序执行后的输出结果是( )。 #include "stdio.h"
void main()
{
int i;
for(i=1;i+1;i++)
{
if(i>4)
{ printf("%d\n",i);
break;
}
printf("%d\n",i++);
}
}
下列程序执行后的输出结果是( )。 #include "stdio.h"
void main()
{
int a=-1,b=1,k;
if((++a<0)&&!(b--<=0))
printf("%d,%d\n",a,b);
else
printf("%d,%d\n",b,a);
}
