更多"有以下程序
#include
#include
typede"的相关试题:
[单项选择]有以程序
#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 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
int num;double s;)REC;
void funl(REC x)x.num=23;x.s=88.5;
main( )
REC a=16,90.0);
fun1(a);
printf("%d/n",a.num);
程序运行后的输出结果是______。
[单项选择]有以下程序:
#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 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);
[单项选择]设有以下程序段:
struct MP3
char name[20];
char color;
float price;
std,*ptr;
ptr=&std;
若要引用结构体变量std中的color成员,写法错误的是( )。
A. std.color
B. ptr→color
C. std→color
D. (*ptr).color
[填空题]
以下程序运行时输出到屏幕的结果中第一行是()第二行是()
#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 STU
char name[10];
int num;
int Score;
main( )
struct Stu s[5]="YangSan",20041,703,"LiSiGuo",20042,580,
"WangYin",20043,680,"SunDan",20044,550,
"Penghua",20045;537,*p[5],*t;
int i,j;
for(i=0;i<5;i++)p[i]=&s[i];
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(p[i]->Score>p[j]->Score)
t=p[i];p[i]=p[j];p[i]=t;
printf("%d%d/n",s[1].Score,p[1]->Score);
执行后输出结果是
A. 550550
B. 680680
C. 580550
D. 580680
[单项选择]若有以下说明,则对初值中字符a的引用方式为( )。
static struct
char ch;
double x;
char a( );
c[2] [3]=
’a’,3.5,"bc",
’c’,4.5,"de",
’m’,8.6,"abc"
,
’d’,8.5,"ic",
’b’,5.5,"dc",
’n’,8.6,"anc’
;
A. ch
B. c[0][0].ch
C. c[1][1].ch
D. a[0]
[填空题]
以下程序运行时输出结果中第-行是(),第二行是(),第三行是()
#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);
}
[单项选择]若有以下的说明,对初值中整数2的正确引用方式是( )。
static struct
char ch;
int i;
double x;
a[2][3]='a',1,3,45,'b',2,7,98,'c',31,93;
A. a[0][1].ch
B. a[0][1].i
C. a[0][0].i
D. a[0][2].i
[单项选择]有以下程序
#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