填空题

以下程序的执行结果是______。 #inelude<iostream.h> class Sample { public: int x; int y; void disp( ) { cout<<"x="<<x<<",y="<<y<<endl; } }; void main( ) { int Sample::*pc; Sample s; pc=&Sample::x; s.*pc=10; pc=&Sample::y; s.*pc=20; s.disp( ); }

【参考答案】

x=A0,y=B0
<上一题 目录 下一题>
热门 试题

填空题
下列程序的运行结果是______。#include<iostream.h>class Base{public:void f(int x){cout<< Base: <<x<<endl;}};class Derived:public Base{public:void f(char*str){cout<< Derived: <<str<<endl;)};void main(void){Base*pd=new Base;pd=new Derived;pd->f(’a’);}
填空题
下列程序用于将源文件中的字母进行大小写转换,while的条件是______。#include<iostream.h>#include<fstream.h>#include<iomanip.h>void main( ){char ch;fstream filel,file2;char fnl[10],fn2[10];cout<< 输入源文件名: ;cin>>fn1;cout<< 输入目标文件名: ;cin>>fn2;filel.open(fnl,ios::in);file2.open(fn2,ios::out);while(______){if(ch>=’a’&&ch<=’z’)ch=ch=’a’+’A’;file2.put(ch);}filel.close( );file2.close( );}
相关试题
  • 设有如图所示的二叉树 则对该二叉树前序遍...
  • 设有char str[80];以下不能将输入数...
  • 对于拷贝构造函数和赋值操作的关系,正确的是
  • 在深度为6的满二叉树中,叶子结点的个数为
  • 下列叙述中正确的是