题目内容

Write the output of the following program:#include struct student{char *s;int age,score;};int main(){int i,k=0;struct student *p;struct student a[5]= {{"mike",21,98},{"tom",19,89},{"jack",24,91},{"alice",20,97},{"mary",18,91}};p=a;for(i=0; i<5; i++){if (*a[i].s=='a') printf("%d\n",a[i].age);if (a[k].score>a[i].score) k=i;}printf("%d\n",p->score);printf("%s\n",a[k].s);return 0;}(提示:for循环中第一个if用来判断每位学生的姓名的第一个字符是否为’a’,是的话输出他的年龄。第二个if语句用来取出成绩最低的学生,用k记录该学生的下标。最后两个输出中,p 指针指向a[0]地址,取出其成绩进行输出。最后输出最低成绩学生的姓名。)

查看答案
更多问题

Write the output of the following program:#include int main(){struct student{char name[10];int k1;int k2;} a[3]= {{"he",90,80,},{"wang",95,80},{"wu",90,98}},*p=a;printf("name:%s scr:%d\n",p->name,p->k1+p->k2);printf("total:%d\n", a[0].k2+a[1].k2+a[2].k2);return 0;}(提示:输出第一位学生的姓名和成绩总和,输出所有学生第二门成绩总和。)

编程,对n 个输入数按绝对值从小到大排序后输出(运行时先输入n 的值,然后用malloc函数为数组动态分配存储单元)。(提示:(1)采用动态分配方式创建float *p =(float*)malloc(n*sizeof(float));用于保存数据,并最后进行内存回收free(p);(2)通过循环读入数据(3)通过选择法或冒泡法进行排序(4)输出结果。)

土壤水分类型中对植物最有效的类型是()。

A. 吸湿水
B. 重力水
C. 膜状水
D. 毛管水

称风干土5.0g,其烘干后的烘干土重为4.5g,则土壤吸湿水含量为( )。

A. 11.1%
B. 10.0%
C. 90%
D. 以上都不对

答案查题题库