A.on
B.out
C.in
第1题:
阅读下列函数说明和C++代码,回答问题
[说明]
任何一种程序都是为了解决问题而撰写的,解决问题时需要实现一些特定的运算法则。在策略(Strategy)模式下,可以更换实现算法的部分而不留痕迹,切换整个算法,简化改为采用其他方法来解决同样问题。
以下是一个“剪刀石头布”游戏。猜拳时的“策略”有2种方法:第一种是“猜赢后继续出同样的招式”(WinningStrategy),第二种是“从上一次出的招式中,以概率分配方式求出下一个招式的几率”(ProbStrategy)。程序中定义了Hand类表示猜拳时的“手势”,类内部以0(石头)、1(剪刀)、2(布)来表示。Hand类的实例只会产生3个。以下是C++语言实现,能够正确编译通过。
[C++代码]
class Hand{
private:
int handvalue;
static Hand *hand0;
static Hand *hand1;
static Hand *hand2;
(1) ;
Hand(int handvalue){
this->handvalue = handvalue;
}
public:
(2) Hand* getHand(int handvalue){
/*省略具体实现*/
}
};
Hand *Hand::hand0 = new Hand(0);
Hand *Hand::hand1 = new Hand(1);
Hand *Hand::hand2 = new Hand(2);
class Strategy{
public:
(3) Hand* nextHand() = 0;
};
class WinningStrategy : public Strategy{
private:
bool won;
Hand *prevHand;
public:
winningStrategy(){
won = false;
}
Hand* nextHand(){
if(!won){
prevHand = Hand::getHand(rand()%3);
}
return prevHand;
}
};
class probstrategy : public Strategy{
public:
Hand* nextHand(){
int handvalue = 0;
/*省略具体实现*/
return Hand::getHand(handvalue);
}
};
class Player{
private:
string name;
Strategy* strategy;
public:
Player(string name, (4) strategy){
this->name = name;
this->strategy = strategy;
}
Hand *nextHand()(//向战略请示手势
return (5) ;
}
};
第2题:
A、yours or his
B、yours or him
C、your's or his
D、you or he
第3题:
7. Hi! This is_______ new teacher.__________ name is Linda.
A. your; My
B. his; Your
C. your ; Her
D. her; His
第4题:
48.
A. my
B. his
C. their
D. your
第5题:
What's ( )job? Are ( ) British?
A. your, your
B. you, your
C. your, you
第6题:
If you _____time, will you send the letter for me, please?
A. have
B. are having
C. have had
第7题:
A.you
B.your
C.yours
D.your's
第8题:
Nice to meet____(your).
第9题:
( ) – Is Miss White __________ English teacher, Maria?
– No, she teaches __________ geography.
A.your;my
B.you;mine
C.you;us
D.your;us
第10题:
Your ______ working on my vessel has acknowledged the truth of and liability for the damage.
A.representative
B.DP
C.ship-owner
D.man