有以下程序#includestdio.h#includesiring.htypedef 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;i2;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]);prinff("%s,%c,%d,%d\n",c.name,c.sex,c.score[0],c.score[1]);}程序运行后的输出结果是A.Zhao,m,85,90,Qian,f,95,92B.Zhao,m,85,90,Zhao,m,85,90C.Qian,f,95,92,Qian,f,95,92D.Qian,f,95,92,Zhao,m,85,90
有以下程序
#include<stdio.h>
#include<siring.h>
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]);
prinff("%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
相关考题:
有以下程序:includevoid fun(char**p){++P;printf("%s\n",*p);}main()char*a[]={"Morn 有以下程序: #include<stdio.h> void fun(char**p) { ++P;printf("%s\n",*p);} main() char*a[]={"Morning","Afternoon","Evening","Night"}; fun(A); } 程序的运行结果是( )。A.AfternoonB.fternoonC.MorningD.oring
有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。
有以下程序includestruct STU{char name[10];int num;};void f(char*name, intnum){s 有以下程序 #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]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041
有以下程序:includevoid fun(char *a,char*B){while(*a=='*')a++;while(*b=*A){b++;a+ 有以下程序: #include<stdio.h> void fun(char *a,char*B){while(*a=='*')a++; while(*b=*A){b++;a++;} } main() {char*s="****a*b****",t[80]; fun(s,t);puts(t); } 程序的运行结果是( )。A.*****a*bB.a*bC.a*b****D.ab
有以下程序includemain(){ char*p,*q;p=(char *)malloc(sizeof(char)*20);q=p;scanf( 有以下程序 #include<stdlib.h> main() { char*p,*q; p=(char *)malloc(sizeof(char)*20);q=p; scanf(“%s%s”,p,q);printf(“%s%s\n”,p,q); } 若从键盘输入:abc def<回车>,则输出结果是A.def defB.abc defC.abc dD.d d
有以下程序段char.name[20];int num;scanf(“name=%s num=%d”,name,&num);当执行上述程序段,并从键盘输入:name=Lili num=1001回车后,name的值为A.LillB.name=LiliC.Lili.num=D.name=Lili num—1001
有以下程序: #include 〈iostream〉 #include 〈string〉 using namespace std; class visited { private: int number; char *name; public: static int glob; void set mes(char *a); }; void visited::set mes(char *a) { name=new char[strlen(A) +1]; strcpy(name,A) ; number=++glob; } int visited::glob-O; int main() { visited person[10]; int i; char str[8]; for(i=0;i5;i++) { cinstr; person[i] .set mes(str); } coutA.5B.4C.3D.2
有以下程序include main(){ char *p,*q;p=(char*)malloc(sizeof(char)*20);q=p;scanf 有以下程序 #include <stdlib.h> main() { char *p,*q; p=(char*)malloc(sizeof(char)*20); q=p; scanf("%s %s",p,q); printf("%s %s\n",p,q); } 若从键盘输入:abc def<回车>, 则输出结果是A.def defB.abc delC.abc dD.d d
有以下程序:includemain(){char *p,*q; p=(char*)malloc(sizeof(char)*20);q=p; scan 有以下程序: #include <stdlib.h> main() { char *p,*q; p=(char*)malloc(sizeof(char)*20);q=p; scanf("%s%s",p,q); printf("%s%s\n",p,q); } 若从键盘输入:abc def<回车>,则输出结果是( )。A.def defB.abc defC.abe dD.d d
有以下程序: include main( ) { char *p ,* q; p=(char * )malloc(sizeof(char 有以下程序: #include<stdlib.h> main( ) { char *p ,* q; p=(char * )malloc(sizeof(char) * 20);q=p; scanf("%s%s",p,q); printf("%s%s\n",p,q); } 若从键盘输入:abc def<回车>,则输出结果是A.def defB.abc defC.abc dD.d d