题目内容

下列程序的结果是( )。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];}int main(void){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]);return 0;}

A. Qian, f, 95, 92
B. Qian, m, 85, 90
C. Zhao, f, 95, 92
D. Zhao, m, 85, 90

查看答案
更多问题

下列程序的输出结果是( )。struct stu { int num; char name[10]; int age; };void fun(struct stu *p){printf("%s\n",(*p).name;}int main(void){struct stu students[3] = {{9801, "Zhang", 20}, {9802, "Wang",19}, {9803, "Zhao",18}}; fun(student + 2);}

A. Zhang
B. Zhao
C. Wang
D. 18

下列程序的输出结果是( )。struct stu { char name[10]; float score[3]; } ;int main(void){struct stu s[3] ={{"20021", 90, 95, 85}, {"20022", 95, 80,75}, {"20023", 100, 95, 90}};struct ste *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

下列程序的输出结果是( )。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);}int main(void){struct STU s[2] = { {"YangSan", 20041}, {"LiSiGuo", 20042} }, *p;p = &s[1]; f (p->name,p->num);printf("%s %d\n",p->name, p->num);}

A. SunDan 20042
B. SunDan 20044
C. LiSiGuo 20042
D. YangSan 20041

如果结构变量s中的生日是“1984年11月11日“,下列对其生日的正确赋值是()。struct student{int no; char name[20]; char sex;struct{int year; int month; int day;}birth;}s;

A. year = 1984; month = 11; day = 11;
B. birth.year = 1984; birth.month = 11; birth.day = 11;
C. s.year =1984; s,month = 11; s.day = 11;
D. s.birth.year = 1984; s.birth.month = 11; s.birth.day = 11;

答案查题题库