有以下程序
#include <stdio.h>
typedef struct
{ int num;double s ; }REC;
void fun1( REC x ){x.num=23; x.s=88.5;}
main()
{ REC a={16,90.0 };
fun1(a);
printf("%d\n",a.num);
}
程序运行后的输出结果是 【 1 4 】 。
第1题:
有以下程序: #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 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第2题:
有以下程序:
#include <stdlib.h>
struct NODE
{ int num; struct NODE *next; };
main()
{ struct NODE *p,*q,*r;
p=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)mallloc(sizeof(struct NODE));
r=(struct NODE*)malloc(sizeof(struct NODE));
p->num=10;q->num=20; r->num=30;
p->next=q;q->next=r;
printf("%d\n",p->num+q->next->num);
}
程序运行后的输出结果是( )。
A.10
B.20
C.30
D.40
第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.2
B.3
C.4
D.5
第4题:
下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int){num=i;} A(ABm){num=a.num++;} void print(){cout<<num;} }; void main() { Aa(1),b(a); a.print(); b.print(); }
A.11
B.12
C.21
D.22
第5题:
有以下程序:#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 537
B.20044 550
C.20042 580
D.20041 703