更多"有以下程序: #include <stdio.h> 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 550
B. 680 680
C. 580 550
D. 580 680
[单项选择]有以下程序
#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 20042
B. SunDan 20044
C. LiSiGuo 20042
D. YangSan 20041
[单项选择]有以下程序:
#include
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},{"LiSiGao",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
[单项选择]有以下程序
#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<3;i++)
sum=sum+p->score[i];
cout < < sum;
程序运行后的输出结果是
A. 260
B. 270
C. 280
D. 285
[单项选择]有以下程序:
#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/n",s[0].num,s[0].TotalScore);
}
程序运行后的输出结果是______。
A. 20045 537
B. 20044 550
C. 20042 580
D. 20041 703
[简答题]有以下程序:
#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);
执行后的输出结果是( )。
[填空题]有以下程序:
# 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);
程序运行后的输出结果是 【8】 。