更多"有以下程序 #include<stdio.h> typedef"的相关试题:
[单项选择]有以下程序
#include
#include
typedef struct {char name[9]; char sex; int score[2]; } STU;
STU f(STU a)
{ STU b={"Zhao",’m’,85,90};
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",’f’,95,92}, d;
d=f(c);
printf("%s,%c,%d,%d,",d.name, d.sex, d.score[0], d.score[1]);
printf("%s,%c,%d,%d/n",c.name, c.sex, c.score[0], c.score[1]);
}
程序运行后的输出结果是_______。
A. Zhao,m,85,90,Qian,f,95,92
B. Zhao,m,85,90, Zhao,m,85,90
C. Qian,f,95,92, Qian,f,95,92
D. Qian,f,95,92, Zhao,m,85,90
[单项选择]有以程序
#include
#include
typedef struct char name[9]; char sex; float score[2]; STU;
void 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];main( )
STU c="Qian",’f’,95.0,92.0;
f(C); printf("%s,%c,%2.0f,%2.0f/n",c.name,c.sex,c.score[0],c.score[1]);程序的运行结果是______。
A. Qian,f,95,92
B. Qian,m,85,90
C. Zhao,f,95,92
D. Zhao,m,85,90
[填空题]有以下程序
#include<stdio.h>
typedef struct
{
int num;double s;
}REC;
void funl(REC *x)
{
x->num=23;x->s=88.5;
}
void main( )
{
REC a={16,90.0};
fun1(&a);
printf("%d/n",a.num);
}
程序运行后的输出结果是______。
[填空题]有以下程序
#include<stdio.h>
typedef struct
int num;double s;
REC;
void funl(REC *x)
x->num=23;x->s=88.5;
void main( )
REC a=16,90.0;
fun1(&a);
printf("%d/n",a.num);
程序运行后的输出结果是______。
[单项选择]若有以下程序
#include<stdio.h>
typedef struct stu
char name[10],gender;
int score;
STU;
void f(STU a,STU b)
b=a;
printf("%s,%c,%d,",b.name,b.gender,b.score);
main( )
STU a="Zhao",’m’,290,b="Qian",’f’,350;
f(a,b);
printf("%s,%c,%d/n",b.name,b.gender,b.score;
则程序的输出结果是______。
A. Zhao,m,290,Qian,f,350
B. Zhao,m,290,Zhao,m,290
C. Qian,f,350,Qian,f,350
D. Zhao,m,290,Zhao,f,350
[填空题]有以下程序:
#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);
fun1(a);
printf("%d/n",a.num);
程序运行后的输出结果是______。
[单项选择]有以下程序:
#include <stdio.h>
typedef struct { int b, p; }A;
void f(A c)/* 注意:c是结构变量名*/
{ int j;
c.b+=1; c.p+=2;
}
main( )
{ int i;
A a={1, 2};
f(a);
printf("%d, %d/n", a.b, a.P);
}
程序运行后的输出结果是______。
A. 2, 4
B. 1, 2
C. 1, 4
D. 2, 3
[填空题]
有以下程序
#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<stdio.h>
typedef struct abc
{int a,b,c;
};
main( )
{struct abe s[2]={{1,2,3),{4,5,6}};
int t=-s[0].a+s[1].b;
printf("%d/n",t);
}
[单项选择]#include<stdio.h>
typedef struct abc
int a,b,c;
;
main( )
struct abe s[2]=1,2,3),4,5,6;
int t=-s[0].a+s[1].b;
printf("%d/n",t);
[简答题]下面程序实现插入排序算法。typedef struct{ int key; Info otherinfo;}SeqList;void InsertSort(SeqList R[],int n){/* 待排序列保存在R[1..n]中*/ SeqList x; int i,j,k,lo,hi,mi; for (i=2;i<=n;i++) { (1) ; lo=1; hi=i-l; while (lo<=hi) { mi=(lo+hi)/2; if ( (2) ) break; if (R[mi].key>x.key) hi=mi-l; else lo=mi+l; } if (mi=lo) k=i - mi; else k=i - mi-1; for (j=0;j (3) ; R[i-j]=x; }}在空白处填写适当的内容,使该程序功能完整。(1)(2)(3)
[简答题]阅读如下程序typedef struct{int key;char info;}NODE;NODE r[10];fun(NODE r[],int l,int h){ int i,j; NODE x: if(1>=h)return; i=l;j=h;x=r[i]; do(while((rEi-I.key>=x.key)&&(j>i))j— —; if(ii))j++; if(i
[单项选择]设有以下语句:
typedef struct S
{ int g; char h;
[单项选择]设有以下语句:
typedef struct S
{ int g; char h; } T;
则下面叙述中正确的是
A. 可用S定义结构体变量
B. 可以用T定义结构体变量
C. S是struct类型的变量
D. T是structs类型的变量
[填空题]已知链表结点定义如下:
typedef struct node{
char data[16];
struct node *next;
} LinkStrNode;
如果每个字符占1个字节,指针占4个字节,则该链表的存储密度是___________。
[填空题]以下说明语句中, [15] 是结构体类型名。
typedef struct
int n;
char ch[8];
PER;
[简答题]已知二叉树的定义如下:typedef struct node{ int data; struct node *lchild, *rchild;}*Bitptr;编写递归算法求二叉树的高度。函数原型为:int f34(Bitptr t);
[填空题]以下说明语句中,______是结构体类型名。
typedef struct
int n;
char ch[8];
PER;