更多"有以下程序: #include<stdio.h> typedef "的相关试题:
[单项选择]有以下程序
#include
#include
typedef struct {char name[9]; char sex; int score[2]; } STU;
STU f(STU a)
{ STU b={"Zhao",’m’,85,90};
int i;
strcpy(a.name,b.name);
a.sex=b.sex;
for(i=0;i<2;i++) a.score[i]=b. score[i];
return a;
}
main( )
{ STU c={"Qian",’f’,95,92}, d;
d=f(c);
printf("%s,%c,%d,%d,",d.name, d.sex, d.score[0], d.score[1]);
printf("%s,%c,%d,%d/n",c.name, c.sex, c.score[0], c.score[1]);
}
程序运行后的输出结果是_______。
A. Zhao,m,85,90,Qian,f,95,92
B. Zhao,m,85,90, Zhao,m,85,90
C. Qian,f,95,92, Qian,f,95,92
D. Qian,f,95,92, Zhao,m,85,90
[单项选择]有以程序
#include
#include
typedef struct char name[9]; char sex; float score[2]; STU;
void f( STU a)
STU b="Zhao",’m’,85.0,90.0; int i;
strcpy(a.name,b.name);
a.sex=b.sex;
for(i=0;i<2;i++) a.score[i]=b.score[i];main( )
STU c="Qian",’f’,95.0,92.0;
f(C); printf("%s,%c,%2.0f,%2.0f/n",c.name,c.sex,c.score[0],c.score[1]);程序的运行结果是______。
A. Qian,f,95,92
B. Qian,m,85,90
C. Zhao,f,95,92
D. Zhao,m,85,90
[单项选择]有以下程序:
#include <stdio.h>
typedef struct { int b, p; }A;
void f(A c)/* 注意:c是结构变量名*/
{ int j;
c.b+=1; c.p+=2;
}
main( )
{ int i;
A a={1, 2};
f(a);
printf("%d, %d/n", a.b, a.P);
}
程序运行后的输出结果是______。
A. 2, 4
B. 1, 2
C. 1, 4
D. 2, 3
[填空题]
有以下程序
#include<stdio.h>
typedef struct
{int num;double s;}REC;
void funl(REC x){x.num=23;x.s=88.5;}
main( )
{ REC a=<16,90.0};
funl (A) ;
printf("%d/n",a.mum);
}
程序运行后的输出结果是______。
[单项选择]#include<stdio.h>
typedef struct abc
int a,b,c;
;
main( )
struct abe s[2]=1,2,3),4,5,6;
int t=-s[0].a+s[1].b;
printf("%d/n",t);
[填空题]有以下程序
#include<stdio.h>
typedef struct
{
int num;double s;
}REC;
void funl(REC *x)
{
x->num=23;x->s=88.5;
}
void main( )
{
REC a={16,90.0};
fun1(&a);
printf("%d/n",a.num);
}
程序运行后的输出结果是______。
[填空题]有以下程序
#include<stdio.h>
typedef struct
int num;double s;
REC;
void funl(REC *x)
x->num=23;x->s=88.5;
void main( )
REC a=16,90.0;
fun1(&a);
printf("%d/n",a.num);
程序运行后的输出结果是______。
[简答题]#include<stdio.h>
typedef struct abc
{int a,b,c;
};
main( )
{struct abe s[2]={{1,2,3),{4,5,6}};
int t=-s[0].a+s[1].b;
printf("%d/n",t);
}
[单项选择]有以下程序 #include<iostream.h> struct STU { char num[10]; float score[3];}; void main( ) { struct STU s[3]={ { "20021",90,95,85 }, {"20022",95,80,75 }, {"20023",100,95,90 } },* p=s; int i; float sum=0; for(i=0;i<3;i++) sum=sum+p->score[i]; cout < < sum;} 程序运行后的输出结果是
A. 260
B. 270
C. 280
D. 285
[单项选择]有以下程序段:
typedef struct NODE
int num, struct NODE *next;
OLD;
以下叙述中不正确的是( )。
A. 以上的说明形式合法
B. NODE是一个结构体类型
C. OLD是一个结构体类型
D. NODE是一个结构体变量
[单项选择]有以下程序段:
typedef struct NODE
int num; struct NODE *next;
OLD;
以下叙述中正确的是
A. 以上的说明形式非法
B. NODE是一个结构体类型
C. OLD是一个结构体类型
D. OLD是一个结构体变量
[单项选择]若有以下程序段:
struct st
int n;
int*m:
;
int a=2,b=3,c=5;
struct st s[3]=(101,&a,102,&c,103,&b);
main( )
struct st*p;
p=s;
则以下表达式中值为5的是()。
A. (*p).m
B. *(p+1)->m
C. *(p++)->n
D. (p++)(*m)
[填空题]
以下程序运行时输出到屏幕的结果中第一行是()第二行是()
#include
Typedef struct
{int dm; /*产品代码*/
Char *mc; /*产品名称*/
Long je; /*金额*/
}PRO;
Void main( )
{ int I j,k,n=3;
PRO
sell[10]={{101,apple,100},{301,orange,100},{101,apple,200}},xy;
For(i=0;i { k=I;
For(j=i+1;j If(sell[k].dm If(k!=i)
{xy=sell[i];
Sell[i]=sell[k];
Sell[k]=xy;
}
}
For(i=0;i Printf(%15d%10s%5d/n,sell[i].dm_sell[i].mc.sell[i].je);
}
[单项选择]有以下程序段:
struct st
int x; int *y; ) *pt;
int a[]=1, 2), b[]=3, 4);
struct st c[2]=10, a, 20, b;
pt=c;
以下选项中表达式的值为11的是( )。
A. *pt->y
B. pt->x
C. ++pt->x
D. (pt++) ->x
[单项选择]若有以下程序段:
struct dent
int n;
int *m;
;
int a=1,b=2,c=3;
struct dent s[3]=101,&a,102,&b,103,&c;
struct dent *p=s;
则以下表达式中值为2的是( )。
A. (p++)->m
B. *(p++)->m
C. (*p).m
D. *(++p)->m
[填空题]
以下程序运行时输出结果中第-行是(),第二行是(),第三行是()
#include
typedef struct{int x;int y;}S;
void fun(S pp[],int n)
{int i,j,k;S t;
for(i=0;i { k=i;
for(j=i+1;j if((pp[j].x k=j;
if(k!=i)
{t=pp[i];pp[i]=pp[k];pp[k]=t;}
}
}
void main( )
{S a[5]={{3,2},{3,1},{1,2},{2,4},{2,3}};
int i,n=5;
fun(a,n);
for(i=0;i printf("%d,%d/n",a[i].x,a[i].y);
}