网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
有以下程序#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;STU 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]; return a;}main(){ STU c={Qian,'f',95.0,92.0},d; d=f(c); printf(%s,%c,%2.0f,%2.0f, d.name, d.sex, d.score[0], d.score[1]);}程序的运行结果是(  )。
A

Qian,m,85,90

B

Zhao,m,85,90

C

Qian,f,95,92

D

Zhao,f,95,92


参考答案

参考解析
解析:
struct变量作为形参和返回值时,传递的是结构体类型的值。f函数中,把b变量赋值给a,然后将a返回并赋值给d,所以,d中的数据与b的数据相同。答案选择B选项。
更多 “单选题有以下程序#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;STU 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; i2; i++) a.score[i]=b.score[i]; return a;}main(){ STU c={Qian,'f',95.0,92.0},d; d=f(c); printf(%s,%c,%2.0f,%2.0f, d.name, d.sex, d.score[0], d.score[1]);}程序的运行结果是(  )。A Qian,m,85,90B Zhao,m,85,90C Qian,f,95,92D Zhao,f,95,92” 相关考题
考题 下列程序的输出结果是______。 include include using namespace std; voi 下列程序的输出结果是______。include<iostream.h>include<string.h>using namespace std;void fun(const char*s,char C) {c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

考题 有下列程序:includeinclude "string.h"typedef struct{char name[9]; char sex;float 有下列程序: #include <stdio.h> #include "string.h" 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,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m, 85,90

考题 从键盘上输入XXYYZZXYZWXP和X,以下程序的输出结果是【】。 include include 从键盘上输入XXYYZZXYZWXP和X,以下程序的输出结果是【 】。include<iostream.h>include<string.h>void main(){char*str,ch;int count=0,pos;cin>>str>>ch;pos=strlen(str)-1;while(pos>=0){if((str[pos])=ch)count++;pos--;}cout<<"count="<<count;}

考题 以下程序的运行结果是#include "stdio.h"main(){struct date{int year,month,day;}today;printf("%d\n",sizeof(struct date));}A.6B.8C.10D.12

考题 执行下面的程序时,输入abc(其中CR代表回车),输出结果是()。includeinclude 执行下面的程序时,输入abc<CR>(其中CR代表回车),输出结果是( )。 #include<stdio.h> #include <string.h> main() { char ch; while((cn=getchar())!='n') { switch(ch-'a') { case 0: putchar(ch+1); case 1:putchar(ch+1);break; case 2:putchar(ch+2); caSe 3:putchar(ch+2);break; } } }A.abcB.bbcC.abcdD.bbcee

考题 有以下程序 include typedef struct { int num;double s; }REC; void funl(REC *x) { x 有以下程序 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); } 程序运行后的输出结果是( )。

考题 当执行以下程序时,输入1234567890,则其中while循环体将执行【 】次。include main() 当执行以下程序时,输入1234567890<回车>,则其中while循环体将执行【 】次。include<stdio.h>main(){ char ch;while((ch=getchar())=='0')prinft("");}

考题 有以下程序 include struct tt { int x; struct tt *y; } *p; s 有以下程序 #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,17C.15,30,D.20,15,

考题 有以下程序 include include typedef struct { cha 有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU 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]; return a; } main() { STU c={"Qian", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, sex, score[O], d.score[1]); } 程序的运行结果是A.Qian, f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92

考题 下列程序的运行结果为【】。 include include {int a; char b[10]; double c;}; 下列程序的运行结果为【 】。include<stdio.h>include<string.h>{ 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.lf\n",a.a,a.b,a.C);}void f(struct A*t){ strcpy(t->b, "ChangRong");}

考题 有以下程序:include include main( ) {char a[ 7 ] = "a0 \0a0 \0";int i, 有以下程序:#include <stdio.h>#include <string.h>main( ) { char a[ 7 ] = "a0 \0a0 \0"; int i,j; i = sizeof(a); j = strlen(a); printf(" % d %d \n" ,i,j); }程序运行后的输出结果是( )。A.22B.76C.72D.62

考题 有以下程序: include include struct NODE {int num;struct NODE *next; } 有以下程序:#include <stdio.h>#include <stdlib.h>struct NODE{ int num;struct NODE *next;};main(){ struet NODE *p,*q,*r;int sum=0;p=(struct NODE *) malloc(sizeof(struct NODE));q=(struct NODE *) malloc(sizeof(struet 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.3B.4C.5D.6

考题 以下程序的输出结果是【】。 include main() {struct stru {int a; float b; char d[4]; } 以下程序的输出结果是【 】。include<stdio.h>main(){ struct stru{ int a;float b;char d[4];};printf("%d\n",sizeof(struct stru));}

考题 有以下程序#include "stdio.h"main(){ struct date {int year,month,day;}today; printf("%d\n",sizeof(struct date));}程序的运行结果是A.6 B.8C.12 D.10

考题 有以下程序 include struct st { int x,y;} data[2]={1,10,2,20}; main( 有以下程序 #include <stdio.h> struct st { int x,y;} data[2]={1,10,2,20}; main() { struct st *p=data; printf("%d,",p->y); printf("%d\n",(++p)->x); } 程序的运行结果是______。A.10,1B.20,1C.10,2D.20,2

考题 以下程序:includeincludemain(){char str[]="abcd\n\123\xab";printf("%d" 以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd\n\123\xab"; printf("%d",(str)); } 运行后的输出结果是( )。A.10B.9C.7D.14

考题 有以下程序:include include using namespace std;int main ( ){ ofstream 有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);A.程序编译时出错B.abc#C.abcD.#

考题 有如下程序段#include "stdio.h"typedef union{ long x[2]; int y[4]; char z[8];}atx;typedef struct aa { long x[2]; int y[4]; char z[8];} stx;main(){ printf("union=%d,struct aa=%d\n",sizeof(atx),sizeof(stx));}则程序执行后输出的结果是A.union=8,struct aa=8 B.union=8,struct aa=24C.union=24,struct aa=8 D.union=24,struct aa=24

考题 下面程序的运行结果是 ( ) include include main( ) { char * a=" 下面程序的运行结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char * a="AbcdEf",* b="aBcD" a + +;b + +; printf("%d\n",strcmp(a,b)); }A.0B.负数C.正数D.无确定值

考题 下列程序的输出结果是()。 include include main() {char a[]="\n123\\";pr 下列程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() { char a[]="\n123\\"; printf ("%d,%d\n",strlen(a),sizeof(a)); }A.5,6B.5,5C.6,6D.6,5

考题 有以下程序: include include void f(char * s,char*t){char k; k=*s;*s=* 有以下程序: #include <stdio.h>#include <string.h>void f(char * s,char*t){ char k; k=*s; *s=*t; *t=k; s++; t--; if( * s) f(s,t);}main( ){ char str[10] :"abedefg", * p; p = str + strlen(str)/2+1; f(p,p -2); printf( "% s \n" ,str);程序运行后的输出结果是( )。A.abcdefgB.gfedcbaC.gbcdefaD.abedcfg

考题 有以下程序 include include typedef stmct{ char name[9];char sex;flo 有以下程序#include <stdio.h>#include <string.h>typedef stmct{ 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,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

考题 以下程序 include include main() { char*p1="abc",*p2="ABC",str[50]="xy 以下程序 #include<stdio.h> #include<string.h> main() { char*p1="abc",*p2="ABC",str[50]="xyz"; strcpy(ar+2,strcat(p1,p2)); printf("%s\n",str); } 的输出是______。A.xyzabcABCB.zabeABCC.yzabcABCD.xyabcABC

考题 有以下程序:include include main(){char *p[10]={"abc","aabdfg","dcdbe" 有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。A.2B.3C.4D.5

考题 在下列# include命令中,正确的一条是 ( )A.# include [string.h]B.# include {math.h}C.# include(stdio.h)D.# include<stdio.h>

考题 有以下程序:includeincludemain(){char str[][20]={"Hello","Beijing"},*P 有以下程序: #include <stdio.h> #include <string.h> main() { char str[][20]={"Hello","Beijing"},*P=str[0]; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是( )。A.0B.5C.7D.20

考题 有以下程序:includeincludetypedef struct{char name[9];char sex;float s 有以下程序: #include <stdio.h> #include <string.h> typedef struct{char name[9];char sex;float score[2]}STU; STU f(STU A) {STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.namC) ; a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=b.score[i]; return a; } main() {STU c={"Qian",'f',95.0,92.0},d; d=f(C) ; pintf("%s,%c,%2.of.%2.of\n",d.name,d.sex,d.score[0],score[1]); } 程序的运行结果是( )。A.Qian,f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,C95,92

考题 如果在用户的程序中要使用C库函数中的数学函数时,应在该源文件中使用的include命令是()A、#include〈string.h〉B、#include〈math.h〉C、#include〈stdio.h〉D、#include〈ctype.h〉