填空题
完成下列类的构造函数,初始化语句为 【13】 。
#include <iostream. h>
class Test
{
private:
int x, y;
public,
void Test(int initx, int inity){
______
}
void printx() {cout<<x<<"—"<<y<<"="<<x-y;}
};
void main()
{
Test x(300, 200);
x. printx(); }
【参考答案】
x=initx; y=inity;
热门
试题
填空题
下列程序不能通过编译,应该在划线部分填写的语句是 【9】 。#include<iostream. h>#include<stdlib. h>double Fune(int a, int b, char ch){double x;switch(ch){case ’+’:x=double(a) +b;break;case ’--’:x= double(a) --b;break;case ’ ’:x=double(a) * b;break;case ’ ’:if(B) x=double(a) b;elseexit(1)breakdefault:exit(1);}______}void main(){cout<<Func(32 , 6 ,’--’)<< , ;cout<<Func(32, 6 ,’*’) << , ;cout<<Func(32, 6 ,’ ’) <<end1;}