有以下程序struct STU{ char name[10]; int num; int Score;};main(){ struct STU s[5]={{"YangSan",20041,703}, {"LiSiGuo",20042,580}, {"WangYin",20043,680}, {"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5], *t; int i,j; for(i=0;i5;i++) p[i]=s[i]; for(i=0;i4;i++) for(j=i+1;j5;j++) if(p[i]-Scorep[j]-Score) { t=p[i]; p[i]=p[j]; p[j]=t; } printf("%d %d\n",s[1].Score,p[1]-Score);}程序运行后的输出结果是A.550 550 B.580 550 C.680 680 D.580 680
有以下程序struct STU{ char name[10]; int num; int Score;};main(){ struct STU s[5]={{"YangSan",20041,703}, {"LiSiGuo",20042,580}, {"WangYin",20043,680}, {"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5], *t; int i,j; for(i=0;i<5;i++) p[i]=&s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i]; p[i]=p[j]; p[j]=t; } printf("%d %d\n",s[1].Score,p[1]->Score);}程序运行后的输出结果是A.550 550 B.580 550 C.680 680 D.580 680
相关考题:
有以下程序includestruct STU{char name[10];int num;};void f(char*name, intnum){s 有以下程序 #include <string.h> 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",20041},{"LiSiGuo",20042}},*p; p=s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041
有以下程序: include struct STU (char name[10]; int num; }; 有以下程序: #include <string.h> 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]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041
有以下程序:include struct STU{char name[10]; int num; int Score;};main(){struct 有以下程序: #include <stdio.h> struct STU { char name[10]; int num; int Score; }; main() { struct STU s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5],*t; int i,j; for(i=0;i<5;i++) p[i]=s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i];p[i]=p[j];p[j]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后的输出结果是( )。A.550 550B.680 680C.580 550D.580 680
有以下程序:includeinclude struct STU {char name[10];int hum;};void f( 有以下程序:#include <stdio.h>#include <strine.h> struct STU { char name[10]; int hum;};void f(char * name,iht num){ struct STU s[2] = {{ "SunDan" ,20044} , {" Penghua" ,20045}}; num= s[0]. nnm; strepy(name,s[0], name);}main( ){ struct STU s[2] = {{"YangSan" ,20041 }, { "LiSiGao" ,20042}}, * P; p = s[1]; f(p->name,p->hum); printf("% s %d \n" ,p-> name,p->num);}程序运行后的输出结果是( )。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041
有以下程序:includevoid fun(int* s,int* * d){* *d=*(s+2);}main(){ inta[]={1,2,3, 有以下程序: #include <stdlib.h> void fun(int * s,int * * d) { * *d=*(s+2); } main() { int a[]={1,2,3,4,5},*b; b=(int *)malloc(sizeof(int)); fun(a,B) ; printf("%d\n",*b+1); } 程序的输出结果是( )A.2B.3C.4D.5
设有以下结构体定义及初始化,表达式p->score的结果是()。 struct node { int num; float score; }stu[2]={101,91.5,102,92.5},*p=stu; A)101 B)91.5 C)102 D)92.5A.分析错误#B.该定义使stu[0].num=101,stu[0].score=91.5,stu[1].num=102,stu[0].score=92.5,p指向数组stu的首地址,p->score的值是stu[0].score。#C.分析错误#D.分析错误
【单选题】以下结构体的定义语句中,正确的是______。A.struct student {intnum; char name[10];int age;};stu;B.struct {int num;char name[10];int age;}student; struct studentstu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;
7、若能使程序运行后的输出结果如下: 201501 201502 201503 则空白处填写的表达式或语句应该是 #include <stdio.h> struct student { int age; char num[8]; }; int main() { struct student stu[3]={{20,"201501"},{21,"201502"},{19,"201503"}}; struct student *p=stu; ____________________ return 0; }A.printf("%s\n",(*p).num); printf("%s\n",(p)->num); printf("%s\n",stu[2].num);B.printf("%s\n",(p++).num); printf("%s\n",(p++).num); printf("%s\n",(p++).num);C.printf("%s\n",(p)->num); printf("%s\n",(p)->num); printf("%s\n",(*p).num);D.printf("%s\n",stu[0]->num); printf("%s\n",stu[1]->num); p
以下结构体的定义语句中,正确的是______。A.struct student {int num; char name[10];int age;};stu;B.struct {int num; char name[10];int age;}student; struct student stu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;
6、若能使程序运行后的输出结果如下: 201501 201502 201503 则空白处填写的表达式或语句应该是#include <stdio.h> struct student { int age; char num[8]; }; int main() { struct student stu[3]={{20,"201501"},{21,"201502"},{19,"201503"}}; struct student *p=stu; ____________________ return 0; }A.printf("%s\n",(*p).num); printf("%s\n",(p)->num); printf("%s\n",stu[2].num);B.printf("%s\n",(p++).num); printf("%s\n",(p++).num); printf("%s\n",(p++).num);C.printf("%s\n",(p)->num); printf("%s\n",(p)->num); printf("%s\n",(*p).num);D.printf("%s\n",stu[0]->num); printf("%s\n",stu[1]->num); p