若有如下程序: struct student {char name[10]; float score[3];}stu[3]={{"lili",75,90,90}, {"liudan",90,85,75}; {"guoli",85,85,70}}; main() {int i;float sum=0,aver; for(i=0;i<3;i++) sum=sum+stu[i].score[1]; aver=sum/i; printf("%6.2f\n",aver); } 则程序运行后的输出结果是( )
A.83.33
B.85
C.86
D.86.67
第1题:
有以下程序:street STU{ char num[10]; float score[3]; };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]; printf("%6.2f\n",sum);}程序运行后的输出结果是( )。
A.260
B.270
C.280
D.285
第2题:
有以下程序 #include <stdio.h> #include <string.h> 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", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, &sex, &score[O], d.score[1]); } 程序的运行结果是
A.Qian, f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,f,95,92
第3题:
有以下程序#include "stdio.h"main(){ struct date { int number; float fenzhi; char name; }stu; printf("%d\n",sizeof(stu));} 程序的运行结果是A.3 B.5C.7 D.8
第4题:
有如下说明和定义语句: struct student { int age; char num{8};}; struct student stu[3]={{20,"200401"},{21,"200402"),{19,"200403"}}; struct student *p=stu; 以下选项中引用结构体变量成员的表达式错误的是( )。
A.(p++)->num
B.p->num
C.(*p).num
D.stu[3].age
第5题:
有以下程序段struct STU{ char num[10];float score[3];};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]; printf("%6.2f\n",sum); }程序运行后的输出结果是A.260.00 B.270.00 C.280.00 D.285.00
第6题:
以下程序的输出结果是______。#include<stdio.h>struct stu{ int num; char name[10]; int age;};void fun(struct stu*p){ printf("%s\n",(*p).name);}main(){ struct stu students[3]={ {9801,"Zhang",20}, { 9802,"Wang",19}, { 9803,"Zhao",18} }; fun(students+2);}
A.Zhang
B.Zhao
C.Wang
D.18
第7题:
下列语句段中,正确的是( )。
A.struct { int x; float y; int a[2]; unsigned b[3]; char name[ 10]; };
B.struct stu { unsigned a[3]; unsigned b[4]; }x; int *p=& x.a;
C.street stu { int a; float x[4]; }y={1,1.0}; float data=y.x;
D.struct nd {int a,b; unsigned c[2]=5; };
第8题:
若有定义和语句:struct student { int num; char name[10]; float score;} s[5]={{1,"lili",98.5},{9,"xiaohua",66}},*p=s;printf("%d",*p++);输出结果是1。( )
此题为判断题(对,错)。
第9题:
Qian,m,85,90
Zhao,m,85,90
Qian,f,95,92
Zhao,f,95,92
第10题:
Qian,f,95,92
Zhao,f,95,90
Zhao,m,95,90
Zhao,f,95,92
第11题:
Qian,m,290,Qian,f,350
Zhao,m,290,Qian,f,350
Qian,f,350,Qian,t,350
Zhao,m,290,Zhao,f,350
第12题:
Zhao,m,290,Zhao,m,290
Zhao,in,290,Qian,f,350
Qian,f,350,Qian,f,350
Qian,f,350,Zhao,m,290
第13题:
下面程序和运行运行结果是【 】。
typedef union student
{ char name [10];
long sno;
char sex;
float score [4];
} STU;
main ( )
{ STU a[5];
prinff( "% d\n", sizeof(a) );
}
第14题:
若有如下程序段: struct student { int num;float score; } stu[3]={{10,85},{60,58},{32,23}}; main() { struct student*t; t=stu; } 则下面表达式中值为58的是( )。
A.(*t).num
B.*(t++)->num
C.(*++t)score
D.(++t)->score
第15题:
有以下程序 #include <stdio.h> main() { struct STU{char name[9];char sex;double score[2];}; sturt 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,85,90
C.Zhao,f,95,92
D.Zhao,m,85,90
第16题:
下面程序的运行结果是typedef union student{ char name[10]; long sno; char sex; float score[4];}STU;main(){ STU a[5]; printf("%d\n",sizeof(a));}
第17题:
若有如下定义: struct stu{char name[9];int age;float score;); struct stu class[10]={{"Li",17,67},{"Song",19,80}, {"guo",18,79},{"Zhao",16,69}}; 根据上面的定义,若执行“printf("%s:%d%f",class[3].name,class[3].age,class[3].score);"则输出的正确结果是( )。
A.Song:19,80.000000
B.Zhao:16,69.000000
C.Li:17,67Song;19,80
D.guo:18,79Zhao;16,69
第18题:
有以下程序 #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<
A.260
B.270
C.280
D.285
第19题:
有以下程序: #include <stdio.h> #include <string.h> 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.namC) ; 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) ; pintf("%s,%c,%2.of.%2.of\n",d.name,d.sex,d.score[0],&score[1]); } 程序的运行结果是( )。
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,C95,92
第20题:
数据结构里,struct student { char name[20]; char sex[10]; int age; int score; }; 定义结构体后,定义变量、数组赋值正确的是()。
第21题:
Zhao,m,290,Qian,f,350
Zhao,m,290,Zhao,m,290
Qian,f,350,Qian,f,350
Zhao,m,290,Zhao,f,350
第22题:
Qian,f,95,92
Qian,m,85,90
Zhao,f,95,92
Zhao,m,85,90
第23题:
Zhao,m,290,Qian,m,290
Zhao,m,290,Zhao,m,290
Zhao,m,290,Qian,m,350
Zhao,m,290,Qian,f,350