未分类题

阅读以下说明和C++代码,将应填入(n)处的字句写在对应栏内。
【说明】
C++标准模板库中提供了vector模板类,可作为动态数组使用,并可容纳任意数据类型,其所属的命名空间为std。vector模板类的部分方法说明如下表所示:

【C++代码】
include <iostream>
include <vector>
using namespace (1);
typedef vector< (2) > INTVECTOR;
const int ARRAY_SIZE = 6;
void ShowVector (INTVECTOR &theVector);
int main() {
INTVECTOR theVector;
// 初始化 theVector, 将theVector的元素依次设置为0至5
for (int cEachItem = 0; cEachItem < ARRAY_SIZE; cEachItem++}
theVector.push_back((3));
ShowVector(theVector); // 依次输出theVector中的元素
theVector.erase (theVector.begin () + 3};
ShowVector(theVector);
}
void ShowVector (INTVECTOR &theVector) {
if (theVector.empty ()) {
cout << 'theVector is empty.' << endl; return;
}
INTVECTOR::iterator (4);
for (theIterator=theVector.begin(); theIterator !=theVector.end(); theIterator++) {
cout << *theIterator;
if (theIterator != theVector.end()-1) cout << ', ';
}
cout << end1;
}
该程序运行后的输出结果为:
0,1,2,3,4,5
(5)

A.shangxueba.cn/images/ct_csrppxz200802_crppxprogxcc_00008(20094).jpg'
B.push_back((3));
C.erase
D.begin
E.empty
F.'
G.begin();
H.end();
I.end()-1)

【参考答案】

(1) std (2) int (3) cEachItem (4) theIterator (5) 01245
......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题

未分类题
LETTER 1Dear Ann,T am going to give a dinner party next month.I want my guests to enjoy themselves and to feel comfortable.What is the secret of giving a successful party?SarahLETTER 2Dear Mary,Cook something that would let you spend time with your guests.If a guest offers to help you in the kitchen, accept the offer.It of ten makes people feel more comfortable when they can help.Before serving dinner, while your guests make small talks in the living room, offer them drinks.Some guests may like wine, but make sure to provide soft drinks for people who don t.At the dinner table, let your guests serve themselves.Offer them a second serving after they finish, but don t ask more than once.Most guests will take more if they want.Perhaps the most important rule of all is to be natural.Treat your guests as you want them to treat you when you re in their home that is, act naturally toward them, and don t try too hard to be polite.Have a good time in a pleasant atmosphere.Yours,Vida1.From the first letter we learn that Mary()A.is asking for advice on giving a dinner partyB.knows the secret of giving a pleasant partyC.is going to attend a dinner party2.Anns first piece of advice is that Mary should()A.get the food ready before the guests arriveB.keep the guests away from the kitchenC.accept the guests offer to help3.Ann suggests that Mary offer drinks()A.while the guests are having small talksB.when all the guests have arrivedC.after the guests finish small talks4.When having dinner, the guests are expected to()A.eat their food slowlyB.help the host serve foodC.help themselves to more food5.The most important rule for Mary to follow in treating her guests is to ()A.be as polite as she canB.let them feel at homeC.prepare delicious food
未分类题
&8226;Read the article below about video games.&8226;Choose the best sentence from the opposite page to fill each of the gaps.&8226;For each gap 8-12, mark one letter (A-G) on your Answer Sheet.&8226;Do not use any letter more than once. Strong players Video games let you escape into an alternative reality -- something gaming firms know about at first hand. For as other technology firms face stagnant or shrinking markets, the video-games industry seems to inhabit a parallel universe. It has had a bumper year, maybe the best it ever will. Global sales of games software and hardware will exceed $31 billion this year. This summer, UBS Warburg invested 17% of its model technology portfolio in two games publishers, Electronic Arts and Activision. Gaming, it seems, is recession-proof. The industry is booming because it has its own cycle, as one generation of hardware succeeds another every few years. (8) Games consoles are flying off the shelves. The current line-up is of Sony's PlayStation2, the market leader by far, plus Microsoft's Xbox and Nintendo's GameCube, which are fighting for a distant second place. Each gaming boom is bigger than the last. Children who have grown up with games keep on playing, which expands the market. It also increases the players' average age: the average American gamer is 28. (9) This shift is reflected in the rise of 'mature'-rated games, which now account for 13% of the American market, up from 6% in 2001. (10) Many observers are optimistic about the prospects for games sales next year, particularly in America. But the figures suggest that 2002 was the peak of the cycle, and that the market will shrink next year. Other observers expect console sales to grow only slightly next year. Things will then cool off until the next generation of consoles appears in 2005. The next peak is not expected until 2007. (11) Both are dwarfed by console gaming at the moment, but are the focus of much activity, and could provide recurring revenues to help smooth out the industry's cyclical nature. Online gaming has got off to a small but promising start in recent weeks with the release of adaptors that link consoles over the Internet. In America, Microsoft sold 150,000 starter kits for its 'Xbox Live' service within a week of its launch last month. Sony says it has signed up 175,000 subscribers to its rival online service, launched in August. Both services will launch in Europe next year. Gaming on mobile phones is also taking small but crucial steps forward. Today's phones mostly have one or two simple games built in. The latest handsets have colour screens and can download software remotely. (12) Games take roughly a minute to download, but adding one to a handset is almost as easy as downloading a new ringing tone or screen logo. It is predicted that mobile-gaming revenues will reach $3.5 billion in the next five years; other estimates are higher.A Older players tend to have more disposable income to spend on games than do teenagers.B Their processing power matches that of the arcade-game machines of the 1980s, so classic games run well.C But how much longer will the good times last?D That cycle, unrelated to the broader economic cycle, is now at or near its peak.E But the industry has two new tricks up its sleeve, in the form. of online and mobile gaming.F They are so wisely designed that they can be connected to any game machines.G It has had a bumper year, maybe the best it ever will.(8)