试题与答案

鱼在游泳时,靠尾鳍和躯干部产生前进的动力,靠腹鳍、背鳍、胸鳍保持平衡,靠()保持前进

题型:填空题

题目:

鱼在游泳时,靠尾鳍和躯干部产生前进的动力,靠腹鳍、背鳍、胸鳍保持平衡,靠()保持前进的方向。

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0515/a6ddd405a085a2bd20ac257b9b48bc6d.html

下面是错误答案,用来干扰机器的。

参考答案:D

试题推荐
题型:填空题
用方框中所给词的适当形式填空。
serious,laugh,baby sit  invite, discuss,help,smart, bccause,rain,show
1.Lisa is very_________.  She studies very well.
2.  Thanks for_________me to your birthday party.
3.  Could you_________us your family photos?
4.  The radio says it will stop_________.
5.  On weekends she always_________her brother.
6.  Can you come over to_________our science report?
7.  He is very funny.  He always makes his classmates_________.
8.  Last Saturday my best friend_________me with my math.
9.  He doesn't like talking or laughing.  He's_________and quiet.
10.  Mr.  Green won't go to the concert_________he is'really busy.
查看答案
题型:问答题

[说明]

对多个元素的聚合进行遍历访问时,需要依次推移元素,例如对数组通过递增下标的方式,数组下标功能抽象化、一般化的结果就称为迭代器(Iterator)。模式以下程序模拟将书籍(Book)放到书架(BookShelf)上并依次输出书名。这样就要涉及到遍历整个书架的过程。使用迭代器Iterator实现。图5-1显示了各个类间的关系。以下是C++语言实现,能够正确编译通过。

[图5-1]

[C++代码]

template (1) >

class Iterator

public:

virtual bool hasNext() = 0;

(2) Object* next() = 0;

;

class Book

//省略具体方法和属性

;

class BookShelf

private:

vector books;

public:

BookShelf()

Book* getBookAt(int index)

return &booksindex;

int getLength()

return books. size();

;

template

class BookshelfIterator : public (3)

private:

BookShelf * bookShelf;

int index;

public:

BookshelfIterator(BookShelf *bookShelf)

this->bookShelf = bookShelf;

index = 0;

bool hasNext()//判断是否还有下一个元素

if(index < bookShelf->getLength())

return true;

else

return false;

Objeot* next()//取得下一个元素

return bookShelf->getBookAt(index++);

;

int main()

BookShelf bookShelf;

//将书籍上架,省略代码

Book *book;

Iterator *it = new BookShelfIterator( (4) );

while( (5) )//遍历书架,输出书名

book=(Book*)it->next();

/*访问元素*/

return 0;

 

(1)处填()。

查看答案
微信公众账号搜索答案