正确答案: B
20
题目:设 a=5,b=6,c=7,d=8 ,执行下列语句后,X的值为( )。
查看原题 点击获取本科目所有试题
举一反三的答案和解析:
[单选题]假定窗体的名称(Narne属性)为Forml,则把窗体的标题设置为"VBTest"的语句为( )。
Caption="VBTest"
[单选题]为了使程序的输出的正确结果为: Now is 2004.7.10 10:10:10. 那么应在下列程序划线处填入的正确语句是( )。 那么应在下列程序划线处填入的正确语句是( )。 #include iostream> using namespace std; class TIME; class DATE { public: DATE(int y=2004,int m=1,int d=1) { year=y; month=m; day=d; } friend void DateTime(DATE &d, TIME &t); private: int year, month, day; }; class TIME { public: TIME(iht h=0, int m=0,int s=0) { hour=h; minute=m; second=s; } friend void DateTime(DATE &d,TIME &t); private: int hour,minute, second; }; ______________________ //函数 DateTime 的首部 { cout"Now is"d.year'.'d.month'.'d.day ' 't.hour":"t.minute':'t.second'.'end1; } int main ( ) { DATE d(2004,7,10); TIME t(10, 10, 10); DateTime(d,t); return 0; }
void DateTime(DATE &d,TIME &t)
解析:解析:本题程序中,分别在类DATE和TIME中将普通函数DateTime声明为友元函数,但该友元函数的定义是在类体外进行的。友元函数是一个普通函数,它虽然可以访问类对象的私有成员,但它毕竟不是类中的成员函数,因此在类体外定义友元函数时,不需要像成员函数一样在函数名前加上“类名::”。函数首部的其他定义照抄类中友元函数的声明。所以函数DateTime的首部为voidDateTime(DATE&d;TIME&t),即选项A。