阅读以下程序:includeclass kk{int m;public:static int n;kk(){m=0;1void setvalu 阅读以下程序: #include<iostream.h> class kk { int m; public: static int n; kk() { m=0; 1 void setvalue() { m++; n++; } void output() { cout<<"m="<<m<<",n="<<n<<endl; } }; int kk::n; void main() { kk obj1,obj2; obi1.Setvalue(); obj1.output(); obj2.setValue(); Obj2.output(); } 该程序的执行结果是( )。A.m=1,n=1B.m=l,n=l m=1,n=1 m=1,n=2C.m=1,n=1D.m=1,n=1 m=2,n=1 m=2,n=2
阅读以下程序:includeclass kk{int m;public:static int n;kk(){m=0;1void setvalu
阅读以下程序: #include<iostream.h> class kk { int m; public: static int n; kk() { m=0; 1 void setvalue() { m++; n++; } void output() { cout<<"m="<<m<<",n="<<n<<endl; } }; int kk::n; void main() { kk obj1,obj2; obi1.Setvalue(); obj1.output(); obj2.setValue(); Obj2.output(); } 该程序的执行结果是( )。
A.m=1,n=1
B.m=l,n=l m=1,n=1 m=1,n=2
C.m=1,n=1
D.m=1,n=1 m=2,n=1 m=2,n=2
相关考题:
以下程序的执行结果是______ includevoid func(int); void main(){ int k=4 func(k) 以下程序的执行结果是______include<iostream.h>void func(int);void main(){int k=4func(k) ;func(k) :cout<<end1;}void func(int a){static int m=0;m+=a;cout<<m<<" ";}
下列程序的运行结果是()。includevoid fun (int *a,int*b){int*kk=a;a=b;b=k}void 下列程序的运行结果是( )。 #include< iostream.h> void fun (int *a,int*b) {int*k k=a;a=b;b=k} void main() {int a=2004, b=9,*x=a,*y=b; fun(x, y) ; cout<<a<<" "<<b<<endl:}A.20049B.92004C.0D.编译时出错
该程序运行的结果是( )。#include#include#define M 100void fun(int m, int *a, int *n){ int i,j=0;for(i=1;i=m;i++)if(i%7==0||i==0)a[j++]=i;*n=j;}main(){ int aa[M],n,k;clrscr();fun(10,aa,n);for(k=0;kif((k+1) ==0)printf("\n");else printf("M",aa[k]);printf("\n");}
下列程序的运行结果是 includeclass Location{private:int X.Y;public:void init(i 下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueYA.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2
有以下程序includevoid f(int *p,int *q);main(){ int m=1,n=2,*r=m;f(r, n 有以下程序 #include<stdio.h> void f(int *p,int *q); main() { int m=1,n=2,*r=m; f(r, n); printf("%d,%d",m,n); } void f(int*p,int*q) {p=p+1; *q=*q+1;) 程序运行后的输出结果是______。A.1,3B.2,3C.1,4D.1,2
有如下程序段#include "stdio.h"void fun(int *a,int *b,int *c,int *d,int *e){ int i,j,k,m; for(i=0;i *a;i++) for(j=0;j *b;j++) for(k=0;k*c;k++) for(m=0;m *d;m++) ++*e;}main(){ int a=10,b=10,c=10,d=10,e=0; fun(a,b,c,d,e); printf("%d\n",e);} 则程序段的输出结果是A.10000 B.1000 C.100 D.0
以下程序的输出结果是#include "stdio.h"int *fun(int *a,int *b){ int m; m=*a; m+=*b-3; return(m);}main(){ int x=21,y=35,*a=x,*b=y; int *k; k=fun(a,b); printf("%d\n",*k);}
阅读以下FORTRAN程序 READ(*,*)M,N K=MOD(M,N) 10 IF(K.GT.0)THEN M=N N=K K=MOD(M,N) GOTO 10 END IF WRITE(*,*)N END 若运行以上程序时,由键盘输入25,11,则程序输出为( )。A.3B.2C.1D.0
阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}