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

题目内容 (请给出正确答案)

【填空题】运行下列程序段,输出结果是____。 #include <iostream> using namespace std; struct country { int num; char name[20]; }x[5]={1, "China", 2, "USA", 3, "France", 4, "England", 5, "Spanish"}; void main() { struct country *p; p=x+2; cout<<p->num<<','<<x[0].name<<endl; }


参考答案和解析
2
更多 “【填空题】运行下列程序段,输出结果是____。 #include <iostream> using namespace std; struct country { int num; char name[20]; }x[5]={1, "China", 2, "USA", 3, "France", 4, "England", 5, "Spanish"}; void main() { struct country *p; p=x+2; cout<<p->num<<','<<x[0].name<<endl; }” 相关考题
考题 以下程序的执行结果是【】。 include using namespace std; class base { public: virmal 以下程序的执行结果是【 】。include<iostream>using namespace std;class base{public:virmal void who(){cout<<"Base Class"<<endl;)};class Derivedl:public Base{public:virtual void who(){cout<<"Derivedl Class"<<endl;}};class derived2:public Base{public:virtual void who(){cout<<"Derived2 Class"<<endl;)};int main(int argc,char*argv[]){base obj1,*P;deliVedl obj2;derived2 obj3;p=obj1; p->who();p=obj2; p->who();p=obj3; p->who();return 0;}

考题 有如下程序: include using namespace std; int strle(char a[],char b[]) {int num= 有如下程序:include <iostream>using namespace std;int strle(char a[],char b[]){int num=O,n=O;while (* (a+num) !='\0')num++;while (b [n] ){* (a+num)=b [n];num++;n++;}return(num);}int main (){char strl[80],str2[80],*p1=str1,*p2=str2;cin>>p1;cin>>p2;cout<<strle(p1,p2)<<end1;return 0;}运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是【 】。

考题 有以下程序: include using namespace std; class sample {int x; public:void setx( 有以下程序:include <iostream>using namespace std;class sample{int x;public:void setx(int i){x=i;}int putx (){return x;}};int main ( ){sample *p;sample A[3];A[0] .set>:(5);A[1] .setx(6);A[2] .setx(7);for (int j=0;j<3;j++){p=A[j];cout<<p->putx () <<", ";}cout<<end1;return 0;}执行后的输出结果是【 】。

考题 程序的输出结果是【 】。 include using namespace std; class A{ int x; public: A(int 程序的输出结果是【 】。include <iostream>using namespace std;class A{int x;public:A(int x=1):x(x){cout<<x;}};void main(){A a,b(2),c(3);}

考题 下面程序的输出结果是【】。 include using namespace std; int d=1; fun(int p){ stati 下面程序的输出结果是【 】。include <iostream>using namespace std;int d=1;fun(int p){static int d = 5;d+ =p;cout<<d;return (d) ;}void main ( ) {int a =3;cout<<fun ( a + fun (d) )<<endl;}

考题 若有以下程序段:include using namespace std;int main (){ int a[]={1,4,5}; int *p 若有以下程序段: #include <iostream> using namespace std; int main () { int a[]={1,4,5}; int *p=a[0],x=6, y,z; for (y=0; y<3; y++) z= ( (* (p+y) <x) ? *(p+y) :x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。A.1B.4C.5D.2

考题 有以下程序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

考题 下列程序的输出结果是______。 include using namespace std; void fun(int rf) { 下列程序的输出结果是______。include<iostream>using namespace std;void fun(int rf){rf*=2;}int main(){int num=500;fun(num);cout<<num<<endl;return 0;}

考题 下面程序运行输出的结果是【】。 include using namespace std; int main(){char a[]="C 下面程序运行输出的结果是【 】。include <iostream>using namespace std;int main(){char a[]="Chinese";a[3]='\0';cout<<a<<endl;return 0;}

考题 有以下程序: inClude structNODE{ int num; structNODE*next; }; main() {StructN00E 有以下程序:#inClude <stdlib.h>struct NODE{int num;struct NODE *next;};main(){ Struct N00E *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.3B.4C.5D.6

考题 下列程序的输出结果是【】。 include using namespace std; class A {int a; public:A() 下列程序的输出结果是【 】。include <iostream>using namespace std;class A {int a;public:A():a(9){}virtual void print() const { cout<<a;};};class B: public A {char b;public:B( ){b='S';}void print() const {cout<<b;}};void show(A x){ x.print0;}int main(){ Ad1,*p;B d2;p=d2;d1.print();d2.print0;p->print();show(d1);show(d2);return 0;}

考题 下列程序的输出结果是【】include using namespace std; int main() { int num=500; int 下列程序的输出结果是【 】include<iostream>using namespace std;int main(){int num=500;int ref=num;ref +=100;cout<<num<<end1;return 0;}

考题 有以下程序: include struct STU (char name[10]; int num; }; 有以下程序: #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]={{"YangSall",20041},{"LiSiGao",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

考题 下面程序的运行结果为( )。include using namespace std;void main( ) { for(int a =0 下面程序的运行结果为( )。 #include <iostream> using namespace std; void main( ) { for(int a =0,x =0; !xa < =10; a ++ ); cout << a << endl;A.0B.1C.10D.11

考题 有以下程序: 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 using namespace std;int main(){ char a[10]={' 有以下程序,其输出结果是( )。 #include <iostream> using namespace std; int main(){ char a[10]={'1','2','3','4','5','6','7','8','9',0},*p; int i=8; p=a+i; cout<<p-3<<endl; return 0; }A.6789B.6C.789D.'6'

考题 有以下程序#include stdio.hstruct stu{ int num; char name [10];int age;};Void fun(struct stu *p){ printf("%s\n,p-name);}main( ){ struct stu x[3]={ {01,”Zhang”,20},{02, ” Wang”,19},{03, ”zhao”,18} };fun(x+2);}程序运行后的输出结果是A)ZhangB)ZhaoC)WangD)19

考题 有以下程序: include struct NODE{ int num; struct NODE*next; } main() {structNOD 有以下程序:#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.3B.4C.5D.6

考题 有以下程序 include struct NODE{ int num; struct NODE *next;}; main( ) 有以下程序#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.3B.4C.5D.6

考题 以下程序的执行结果为【】。 include using namespace std; void overload(int num) {cou 以下程序的执行结果为【 】。include<iostream>using namespace std;void overload(int num){cout<<num<<end1;}void overload(char ch){char c=ch+1;cout<<c<<end1;}int main(){overload('X');return 0;}

考题 下列程序的输出结果是【】 include using namespace std; int main() { int Bum=500; in 下列程序的输出结果是【 】include<iostream>using namespace std;int main(){int Bum=500;int ref=num;ref+=100;cout<<num<<end1;return 0;}

考题 有以下程序: include struct NODE { int num; struct NODE*next; }; main() { struct 有以下程序:#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*)mallloc(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.10B.20C.30D.40

考题 有以下程序: #includestdio.h struct stu { int num;char name[l0];int age;}; void fun(struct stu*p) { printf("%s\n",p-name);} main( ) { struct stu x[3]={{01,"Zhang",20),{02,"Wang",l9},{03,"Zha0",l8}}; fun(x+2); } 程序运行后的输出结果是( )。A.ZhangB.ZhaoC.WangD.19

考题 以下程序的输出结果是______。includestruct stu{int num; char name[10]; int age;};v 以下程序的输出结果是______。#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.ZhangB.ZhaoC.WangD.18

考题 有以下程序:includeinclude struct STU {char name[10];int hum;};void f( 有以下程序:#include <stdio.h>#include <strine.h> struct STU { char name[10]; int hum;};void f(char * name,iht num){ struct STU s[2] = {{ "SunDan" ,20044} , {" Penghua" ,20045}}; num= s[0]. nnm; strepy(name,s[0], name);}main( ){ struct STU s[2] = {{"YangSan" ,20041 }, { "LiSiGao" ,20042}}, * P; p = s[1]; f(p->name,p->hum); printf("% s %d \n" ,p-> name,p->num);}程序运行后的输出结果是( )。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

考题 单选题有以下函数:#include struct stu{ int num; char name[10]; int age;};void fun(struct stu *p){ printf(%s, p-name);}main(){ struct stu x[3] = {{01,Zhang,20}, {02,Wang,19}, {03,Zhao,18}}; fun(x+2);}程序运行后的输出结果是(  )。A ZhangB ZhaoC WangD 19

考题 单选题有如下程序:#include #include struct S{ char name[10];};void change(struct S *data,int value){ strcpy(data-name, ****); value=13;}main(){ struct S input; int num = 4; strcpy(input.name, THIS); change(input,num); printf(%s,%d,input.name,num);}程序运行后的输出结果是(  )。A ****,4B ****,13C THIS,4D THIS,13

考题 单选题有以下程序#include #include struct S{ char name[10];};void change(struct S *data, int value){ strcpy(data-name, #); value = 6;}main(){ struct S input;  int num = 3; strcpy(input.name, OK); change(input, num); printf(%s,%d, input.name, num);}程序运行后的输出结果是(  )。A OK,6B #,6C OK,3D #,3