INTVECTOR;constintARRAY_SIZE=6;voidShowVector(INTVECTOR&theVecto..." />

宅男噜噜噜666在线观看,国产1区二区三区,国产日韩欧美大片,国产超碰97,国产自产视频,99久久国产综合精品色伊,亚洲午夜高清

軟題庫 學習課程
當前位置:信管網(wǎng) >> 在線考試中心 >> 試題查看
試題題型【分析簡答題】
試題內(nèi)容

閱讀以下說明和C++代碼,將應(yīng)填入 (n) 處的字句寫在答題紙的對應(yīng)欄內(nèi)。
【說明】
C++標準模板庫中提供了vector模板類,可作為動態(tài)數(shù)組使用,并可容納任意數(shù)據(jù)類型,其所屬的命名空間為std。vector模板類的部分方法說明如下表所示:

【C++代碼】
#include
#include
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;
}
該程序運行后的輸出結(jié)果為:(5)   

查看答案

相關(guān)試題