更多"以下程序运行时输出到屏幕的结果中第一行是()第二行是() #inclu"的相关试题:
[填空题]以下程序运行时输_出到屏幕的结果第一行是 【17】 ,第二行是 【18】 。
#include
typedef struct fact
{ int m,z;
}FACT;
FACT fun1(FACT t1,FACT t2)
{FACT t3;
t3.m=t1.m*t2.m ;
t3.z=t1.z*t2.m+t2.z*t1.m;
retum t3;
}
FACT fun2(FACT t)
{int m,n,k;
m=t.m;
n=t.z;
while(k=m%n)
{ m=n;n=k; }
t.m=t.m/n;
t.z=t.z/n;
return t;
}
void main( )
{FACT s,s1={8,4},s2={6,5};
s=fun1(sl,s2);
printf("%d,%d/n",s.z,s.m);
s=fun2(s);
printf("%d,%d",s.z,s.m);
}
[单项选择]有以下程序
#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
typedef struct{int x;int y;}S;
void fun(S pp[],int n)
{int i,j,k;S t;
for(i=0;i { k=i;
for(j=i+1;j if((pp[j].x k=j;
if(k!=i)
{t=pp[i];pp[i]=pp[k];pp[k]=t;}
}
}
void main( )
{S a[5]={{3,2},{3,1},{1,2},{2,4},{2,3}};
int i,n=5;
fun(a,n);
for(i=0;i printf("%d,%d/n",a[i].x,a[i].y);
}
[填空题]有以下程序
#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
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 structint b, p; ) A;
void f(A c) /*c是结构变量名*/
int j;
c.b+=1; c.p+=2;
main( )
int i;
A. printf("%d, %d/n", a.b, a.p); 程序运行后的输出结果是()。 2, 3
B. 2, 4
C. 1, 4
D. 1, 2
[填空题]以下程序的运行结果是【 】
#include <string.h>
typedef struct student{
char name[10];
long sno;
float score; }STU;
main( )
{ STU a={“zhangsan”,2001,95},b={“Shangxian”,2002,90},
c={“Anhua”,2003,95},d,*p=&d;
d=a;
if(strcmp(a.name,b.name)>0) d=b;
if(strcmp(c.name,d.name)>0) d=c;
printf(“%ld%s/n”,d.sno,p->name); }
[填空题]
有以下程序
#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);
}
程序运行后的输出结果是______。
[填空题]
以下程序的运行结果是 【19】
#include <string.h>
typedef struct student{
char name[10];
long sno;
float score; }STU;
main( )
{ STU a={“zhangsan”,2001,95},b={“Shangxian”,2002,90},
c={“Anhua”,2003,95},d,*p=&d;
d=a;
if(strcmp(a.name,b.name)>0) d=b;
if(strcmp(c.name,d.name)>0) d=c;
printf(“%ld%s/n”,d.sno,p->name);
[填空题]以下程序的运行结果是 【12】 。
# include<string.h>
typedef struct student{
char name[10];
long sno);
float score
} STU;
main( )
{ STU a={"zhangsan",2001,95},b={"Shangxian",2002,90}
c={"Anhua",2003,95},d,*p=&d;
d=a;
if(strcmp(a.name,b.name)>0)d=b;
if(strcmp(c.name,d.name)>0)d=c;
printf("%1d%s/n",d.sno,p->name);
}