网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
设有以下结构体定义及初始化,表达式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.5
A.分析错误#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.分析错误参考答案和解析
该定义使 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。
更多 “设有以下结构体定义及初始化,表达式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.分析错误” 相关考题
考题
有以下说明和定义语句 struct student { int age;char num[8]; struct student stu[3]={{20,"200401"},{21,"200402"},{19,"200403"}}; struct student *p=stu;}; 以下选项中引用结构体变量成员的表达式错误的是A.(p++)->numB.p->numC.(*p).numD.stu[3].age
考题
有以下程序: 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.260B.270C.280D.285
考题
有以下程序 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; p++; for(i=0;i<3;i++)sum=sum+p->score[i]; printf("%6.2f\n",sum); }程序运行后的输出结果是______。A.260B.270C.250D.285
考题
c语言 这个编程有什么问题? 怎么不能运行
void CreateList(struct stu *head){ struct stu=NULL; struct stu *temp=head; int i=1; printf("请输入5位学生的成绩;"); while(i=5) { struct stu *newNode=(struct stu*)malloc(sizeof(struct stu)); newNode-next=NULL; newNode-index=i++; scanf("%f",score); temp-next=newNode; temp-newNode; }}void (){ struct stu *head; head=(struct stu*)malloc(sizeof(struct stu)); head-next=NULL; CreateList(head);}void Insert(struct stu *head){ int index; float score; struct stu *NewNode=(struct stu *)malloc(sizeof(struct stu)); struct stu *p= head; printf("请输入要插入的学生编号;"); scanf("%d", printf("请输入要插入的学生成绩:"); scanf("%f", NewNode-index=index; NewNode-score=score; NewNode-next=NULL; printf("请输入要插入的位置;"); scanf("%d", while(index1next; index--; } NewNode-next=P-next; p-next=NewNode;}
考题
有以下程序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
考题
有以下程序: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.260B.270C.280D.285
考题
有以下程序: include struct STU {int num; float TotalScore;
有以下程序: #include <strino.h> struct STU {int num; float TotalScore; }; void f(struct STU p) {struct STU s[2]={{20044,550},{20045,537}}; p.num=s[1].num;p.TotalScore=s[1].TotalScore; } main() {struct STU s[2]={{20041,703},{20042,580}}; f(s[0]); printf("%d%3.0t\n",s[0].num,s[0].TotalScore); } 程序运行后的输出结果是 ______。A.20045 537B.20044 550C.20042 580D.20041 703
考题
有以下程序: 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 include typedef struct { cha
有以下程序 #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,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92
考题
若有如下程序段: struct student { int num;float score; } stu[3]={{10,85},{60,58},{32,23}}; main() { struct student*t; t=stu; } 则下面表达式中值为58的是( )。A.(*t).numB.*(t++)->numC.(*++t)scoreD.(++t)->score
考题
有以下程序#include string.hstruct STU{ int num; float TotalScore; };void f(struct STU p){ struct STU s[2]={{1047,530},{1048,531}}; p.num = s[1].num; p.TotalScore = s[1].TotalScore;}main(){ struct STU s[2]={{2041,730},{2042,731}}; f(s[0]); printf("%d,%3.0f\n",s[0].num,s[0].TotalScore);}程序的运行结果是A.1047,530 B.1048,531C.2041,730 D.2042,731
考题
有以下程序 struct STU {char num[10];float score[3];}; main() {stmct 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.260B.270C.280D.285
考题
有以下程序: 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[i]=t; } printf("%d %d\n",s[1].Score,p[1]->Score); } 执行后输出结果是( )。A.550 550B.680 680C.580 550D.580 680
考题
有以下程序 include struct NODE{ int num; struct NODE *next;}; main( )
有以下程序#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d\n”,sum);}执行后的输出结果是A.3B.4C.5D.6
考题
有如下说明和定义语句: struct student { int age; char num{8};}; struct student stu[3]={{20,"200401"},{21,"200402"),{19,"200403"}}; struct student *p=stu; 以下选项中引用结构体变量成员的表达式错误的是( )。A.(p++)->numB.p->numC.(*p).numD.stu[3].age
考题
有以下程序段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;i3;i++) sum=sum+p-score[i]; printf("%6.2f\n",sum); }程序运行后的输出结果是A.260.00 B.270.00 C.280.00 D.285.00
考题
有以下说明和定义语句struct student{ int age; char num[8];};struct student stu[3]={{20,"200401"},{21,"200402"},{10\9,"200403"}};struct student *p=stu;以下选项中引用结构体变量成员的表达式错误的是A.(p++)-num B.p-num C.(*p).num D.stu[3].age
考题
有以下程序: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
考题
以下程序的输出结果是______。includestruct stu{int num; char name[10]; int age;};v
以下程序的输出结果是______。#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.ZhangB.ZhaoC.WangD.18
考题
有以下程序 include struct STU { char num[10]; float score[3];}; void ma
有以下程序 #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.260B.270C.280D.285
考题
有以下程序:include include struet STU{ int nam;float TotalSeore;};v
有以下程序:#include <stdio, h>#include <string, h>struet STU{ int nam; float TotalSeore;};void f( strnct STU p){ struct STU s[2] = { {20044,550} ,{20045,537} }; p.num = s [1]. num; p.TotalScore = s [1]. TotalScore;main( ){ struct STU s[2] = {{20041,703} ,{20042,580}}; f(s[0] ); printf( "%d %3.Of\n" ,s[0].num,s[0].TotalSeore); }程序运行后的输出结果是( )。A.20045 537B.20044 550C.20042 580D.20041 703
考题
有以下程序: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
考题
有以下程序 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[i]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后输出结果是A.550550B.680680C.580550D.580680
考题
有以下程序:includeincludetypedef struct{char name[9];char sex;float s
有以下程序: #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,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,C95,92
考题
若有以下说明语句:structstudent{intnum;charname[];floatscore;}stu;则下面的叙述不正确的是:()A、struct是结构体类型的关键字B、structstudent是用户定义的结构体类型C、num,score都是结构体成员名D、stu是用户定义的结构体类型名
考题
有以下说明语句:struct Student{int num;double score;};Student stu[3]={{1001,80},{1002,75},{1003,91}},*p=stu;则下面引用形式错误的是()A、p-numB、(p++).numC、(p++)-numD、(*p).num
考题
单选题有以下说明语句:struct Student{int num;double score;};Student stu[3]={{1001,80},{1002,75},{1003,91}},*p=stu;则下面引用形式错误的是()A
p-numB
(p++).numC
(p++)-numD
(*p).num
考题
单选题有以下程序:#include struct STU{ int num; float TotalScore;};void f(struct STU p){ struct STU s[2] = {{20044,550}, {20045,537}}; p.num = s[1].num; p.TotalScore = s[1].TotalScore;}main(){ struct STU s[2] = {{20041,703}, {20042,580}}; f(s[0]); printf(%d %3.0f, s[0].num, s[0].TotalScore);}程序运行后的输出结果是( )。A
20045 537B
20044 550C
20042 580D
20041 703
热门标签
最新试卷