题目内容

结构数组中存有三人的姓名和年龄,以下程序输出三人中最年长者的姓名和年龄。请填空#includestruct man{char name[20];int age;}person[]={ "LiLing",18,"YangHua",19,"ZhangPing",20};int main(){struct man *p,*q;intold=0;p=person;for(;p________;p++)if(oldage) {q=p; ________}printf("%s %d",q->name,q->age);return 0;}

查看答案
更多问题

下面程序的功能是输入学生的姓名和成绩,然后输出。请填空#includestruct stuinf{ char name[20];/* 学生姓名 */int score; /* 学生成绩 */} stu, *p;int main ( ){ p=&stu;printf("Entername:");gets(________);printf("Enterscore: ");scanf("%d",________);printf("Output:%s, %d\n",________,________);}

下面程序的功能是按学生的姓名查询其成绩排名和平均成绩。查询时可连续进行,直到输入0时才结束。请填空#include#include#define NUM 4struct student{int rank;char *name;float score;};________stu[ ]={3,"liming",89.3, 4,"zhanghua",78.2,  1,"anli",95.1,2,"wangqi",90.6 };int main(){ char str[10];int i;do{printf("Enter a name");scanf("%s",str);for( i=0;i=NUM ) printf("Not found\n");}while(strcmp(str,"0")!=0 );return 0;}

下面程序的功能是从终端上输入5个人的年龄、性别和姓名,然后输出。请填空#include"stdio.h"struct man{ char name[20];unsigned age;char sex[7];};data_in(struct man*p, int n ){struct man *q=________;for( ;page, p->sex);________;}}data_out( structman *p, int n ){struct man *q = ________;for( ;pname, p->age, p->sex);}int main ( ){ struct man person[5];data_in(person,5);data_out(person,5);return 0;}

写出以下程序段的输出结果________。struct str1{ char c[5];char *s;};struct str1 s1[2]={{"ABCD","EFGH"},{"IJK","LMN"} };struct str2{struct str1 sr;int d;}s2={"OPQ","RST",32767};struct str1 *p[2];p[0]=&s1[0];p[1]=&s1[1];printf("%s",++p[1]->s);printf("%c",s2.sr.c[2]);

答案查题题库