更多"[单选题]有以下程序
#include <stdio.h>
"的相关试题:
[单选题]有以下程序
#include
struct S
{ int a,b;}data[2]={10,100,20,200};
main()
{ struct S p=data[1];
printf("%d\n",++(p.a));
}
程序运行后的输出结果是()。
A.10
B.11
C.20
D.21
[单选题]有以下程序
#include
struct ord
{ int x,y;}dt[2]={1,2,3,4};
main()
{
struct ord *p=dt;
printf("%d,",++(p->x)); printf("%d\n",++(p->y));
}
程序运行后的输出结果是()。
A.1,2
B.4,1
C. 3,4
D.2,3
[单选题]有以下程序
#include
struct tt
{int x;struct tt *y;} *p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
void main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{printf("%d,",p->x); p=p->y;}
}
执行后的输出结果是( )。
A.20,15,
B.20,14,
C.28,13,
D.15,20,
[单选题]有以下程序
#include
main()
{struct node{int n;struct node *next;} *p;
struct node x[3]={{2,x+1},{4,x+2},{6,NULL}};
p=x;
printf(“%d,”,p->n);
printf(“%d\n”,p->next->n);
}
程序运行后的输出结果是( )。
A.2,3
B. 2,4
C.3,4
D. 4,6
[单选题]有以下程序
#include
#define S(x) 4*(x)*x+1
main()
{ int k=5,j=2;
printf("%d\n",S(k+j));
}
程序运行后的输出结果是()。
A.197
B.143
C.33
D.28
[单选题]有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。
A.35756
B.23445
C.35745
D.12345
[单选题]有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。
A.a
B.b
C.c
D.d
[单选题]有以下程序
#include
fun(int n, int *s)
{ int f1, f2;
if(n==1||n==2)
*s=1;
else
{ fun(n-1, &f1);
fun(n-2, &f2);
*s=f1+f2;
}
}
void main()
{ int x;
fun(6, &x);
printf("%d\n", x);
}
执行后的输出结果是( )。
A.9
B.8
C.7
D.6
[单选题]有以下程序
#include
#include
void fun(char *w,int m)
{char s,*p1,*p2;
p1=w;p2=w+m-1;
while(p1
A.654321
B.116611
C.161616
D.123456
[单选题]有以下程序
main()
{ int i,s=1;
for (i=1;i<50;i++)
if(!(i%5)&&!(i%3)) s+=i;
printf("%d\n",s);}
程序的输出结果是 ( )。
A.409
B.277
C.1
D.91
[单选题]有以下程序
#include
#define FUN1(a,b) a+b
#define FUN2(a,b) a-b
#define CAL(a,b) a*b+a+3
main()
{
printf("%d\n",CAL(FUN1(3,5),FUN2(4,5)));
}
执行后的输出结果是( )。
A.29
B.28
C.27
D.30
[单选题]有以下程序
#include
void fun(char *c)
{ while(*c)
{ if(*c>='a'&&*c<='z') *c=*c-('a'-'A');
c++;
}
}
void main()
{ char s[81];
gets(s); fun(s); puts(s):
}
当执行程序时从键盘上输入Hello Beijing<回车>,则程序的输出结果是( )。
A.hello beijing
B. Hello Beijing
C.HELLO BEIJING
D. hELLO Beijing
[单选题]有以下程序
#include
int fun (int x,int y)
{ if (x!=y) return ((x+y);2);
else return (x);
}
main()
{ int a=4,b=5,c=6;
printf("%d\n",fun(2*a,fun(b,c)));
}
程序运行后的输出结果是 ()。
A.3
B.6
C.8
D.12