#include
閱讀以下說(shuō)明和C++代碼,將應(yīng)填入 (n) 處的字句寫(xiě)在答題紙的對(duì)應(yīng)欄內(nèi)。午夜无码中文字幕影院,国产自产第一区c国产,久久久久久夜精品精品免费,国产99久久,夜夜夜夜曰天天天天拍国产,欧美日韩亚洲另类专区,国产精品区一区二区免费
【說(shuō)明】
C++標(biāo)準(zhǔn)模板庫(kù)中提供了vector模板類(lèi),可作為動(dòng)態(tài)數(shù)組使用,并可容納任意數(shù)據(jù)類(lèi)型,其所屬的命名空間為std。vector模板類(lèi)的部分方法說(shuō)明如下表所示:
【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的元素依次設(shè)置為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 << endl;
}
該程序運(yùn)行后的輸出結(jié)果為:(5)
相關(guān)試題
更多試題
10年專(zhuān)注信管,信管教育專(zhuān)注者,信管網(wǎng)優(yōu)勢(shì)
免費(fèi)試聽(tīng)信管網(wǎng)信息系統(tǒng)項(xiàng)目管理師課程
全國(guó)前50名高分學(xué)員訪(fǎng)談:董麗(174)、李思...
信息系統(tǒng)項(xiàng)目管理師高端班培訓(xùn)課程
信管老師100小時(shí)直播課程
軟考報(bào)名專(zhuān)題(報(bào)名時(shí)間、入口等)
中級(jí)系統(tǒng)集成項(xiàng)目管理工程師通關(guān)課程
系統(tǒng)規(guī)劃與管理師課程(考試介紹與題型分析)
軟題庫(kù):軟考在線(xiàn)題庫(kù)、支持手機(jī)答題