更多"有以下程序 #include<stdlib.h> struct N"的相关试题:
[单项选择]有以下程序
#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*)malloc(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
[单项选择]有以下程序:
#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. 3
B. 4
C. 5
D. 6
[单项选择]有以下程序:
#include <stdlib.h>
struct NODE
int nurn;
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. 3
B. 4
C. 5
D. 6
[单项选择]有以下程序:
#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
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);
程序运行后的输出结果是______。
[单项选择]有以下程序:
#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. Zhang
B. Zhao
C. Wang
D. 18
[填空题]
有以下程序
#include<stdio.h>
typedef struct
{int num;double s;}REC;
void funl(REC x){x.num=23;x.s=88.5;}
main( )
{ REC a=<16,90.0};
funl (A) ;
printf("%d/n",a.mum);
}
程序运行后的输出结果是______。
[单项选择]
有以下程序
#include
#include
struct A
{ int a; char b[10]; double c;};
void f(struct A t);
main( )
{ struct A a={1001,"ZhangDa",1098.0};
f(a); printf("%d,%s,%6.1f/n",a.a,a.b,a.c);
}
void f(struct A t)
{ t.a=1002; strcpy(t.b,"ChangRong");t.c=1202.0;}
程序运行后的输出结果是()
A. 1001,zhangDa,1098.0
B. 1002,changRong,1202.0
C. 1001,ehangRong,1098.O
D. 1002,ZhangDa,1202.0
[单项选择]以下程序的输出结果是
#include<stdio.h>
struct st
int x;int *y;*p;
int dt[4]=10,20,30,40;
struct st aa[4]=50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],;
main( )
p=aa;
printf("%d/n",++(p->x));
A. 10
B. 11
C. 51
D. 60
[单项选择]
有以下程序:
#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 537
B. 20044 550
C. 20042 580
D. 20041 703
[单项选择]有以下程序
#inGlude<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=(stnlct 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. 3
B. 4
C. 5
D. 6
[单项选择]有以下程序:
#include<stdio.h>
struct tt
int x;struct tt *y; *p;
struct tt a[4]=20,a+1,15,a+2,30,a+3,17,a
main( )
int i;
p=a;
for(i=1;i<=2;i++)printf("%d",p->x);p=p->y;
程序的运行结果是______。
A. 20,30,
B. 30,17
C. 15,30
D. 20,15
[填空题]以下程序运行后的输出结果是 【16】 。
struct NODE
int num;
stmct NODE *next;
;
main( )
struct NODE s[3]=1,’/0’),2,’/0’),3,’/0’),*p,*q,*r;
int sum=0;
s[0].next=s+1;
s[1].next=s+2;
s[2].next=s;
p=s
q=p->next;
r=q->next;
sum+=q->next->num;
sum+=r->next->next->num;
printf("%d/n",sum);