有以下程序
#include
main()
{
struct STU
{ char name[9]; char sex; double score[2];
};
struct STU a={"Zhao",'m',85.0,90.0), b={"Qian",'f',95.0,92.0);
b=a;
printf("%s,%c,%2.0f,%2.0f/n",b.name,b.sex,b.score[0],b.score[1]);
}
程序的运行结果是( )。
A)Qian,f,95,92 B)Qian,m,85,90 C)Zhao,f,95,92 D)Zhao,m,85,90
#include
struct STU
{ char name[10];
int num;
};
void f(char *name,int num)
{
struct STU s[2]={{"SunDan",20044},{"Penghua",20045}};
num=s[0].num;
strcpy(name,s[0].name);
}
main( )
{ struct STU s[2]={{"YangSan",2004},{"LiSiGuo",20042}},*p;
p=&s[1]; f(p->name,p->num);
printf("%s %d/n", p->name,p->num);
}
struct STU
{ char name[10];
int num;
float TotalScore;
};
void f(struct STU *p)
{ struct STU s[2]={{"SunDan",20044,550}, {"Penghua",20045,537}},
*q=s;++p; ++q; *p=*q;
}
main( )
{ struct STU s[3]={{"YangSan",20041,703},{"LiSiGuo",20042,580}};
f(s);
printf("%s%d%3.0f/n",s[1].name,s[1].num,s[1].TotalScore);
}
struct st
{ int x;
int *y;
}*pt;
int a[ ]={l,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 S{
int n;
int a[20];
};
void f(struct S *p)
{ int i,j,t;
for(i=0;in-1;i++)
for(j=i+1;jn;j++)
if(p->a[i]>p->a[j]){t=p->a[i];p->a[i]=p->a[j];p->a[j]=t;}
}
main( )
{ int i;
struct S s={10,{2,3,l,6,8,7,5,4,10,9}};
f(&s);
for(i=0;i }
程序运行后的输出结果是( )。
A)1,2,3,4,5,6,7,8,9,10, B)10,9,8,7,6,5,4,3,2,1,
C)2,3,1,6,8,7,5,4,10,9, D)10,9,8,7,6,1,2,3,4,5,
有下列程序:
struct S{int n;int a[20];};
void f(int *a,int n)
{ int i;
for(i=0;i }
main( )
{ int i; struct S s={10,{2,3,1,6,8,7,5,4,10,9}};
f(s.a,s.n);
for(i=0;i }
程序运行后的输出结果是( )。
A)2,4,3,9,12,12,11,11,18,9, B)3,4,2,7,9,8,6,5,11,10,
C)2,3,1,6,8,7,5,4,10,9, D)1,2,3,6,8,7,5,4,10,9,
#include
struct tt
{ int x;
struct tt *y;
}*p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
main( )
{ int i;
p=a;
for(i=1;i<=2;i+ +)
{printf("%d,",p->x);
p=p->y;
}
}
程序的运行结果是( )。
A)20,30, B)30,17 C)15,30, D)20,15,
46)有下列程序:
#include
#include
typedef struct{
char name[9];
char sex;
float score[2];
}STU;
STU 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];
return a;
}
main( )
{ STU c={"Qian",'f',95.0,92.0},d;
d=f(c);
printf("%s,%c,%2.0f,%2.0f/n",d.neme,d.sex,d.score[0],d.score[1]);
}
程序的运行结果是( )。
A)Qian,f,95,92 B)Qian,m,85,90 C)Zhao,m,85,90 D)Zhao,f,95,92
有以下程序
#include
#include "string.h"
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
燕子,这些题目做对,和上篇的平均80以上就有奖
最新推荐文章于 2022-08-30 16:04:02 发布