#includeusingnamespace(1);typedefvector<(2)>INTVECTOR;constintARRAY_SIZE=6;voidShowVector(..."/>

午夜无码中文字幕影院,国产自产第一区c国产,久久久久久夜精品精品免费,国产99久久,夜夜夜夜曰天天天天拍国产,欧美日韩亚洲另类专区,国产精品区一区二区免费

軟題庫(kù) 移動(dòng)APP 掃碼下載APP 隨時(shí)隨地移動(dòng)學(xué)習(xí) 培訓(xùn)課程
試卷名稱(chēng) 2008年下半年程序員考試下午真題試題(案例分析)
考試中心《2008年下半年程序員考試下午真題試題(案例分析)》在線(xiàn)考試
試卷年份2008年下半年
試題題型【分析簡(jiǎn)答題】
試題內(nèi)容

閱讀以下說(shuō)明和C++代碼,將應(yīng)填入 (n) 處的字句寫(xiě)在答題紙的對(duì)應(yīng)欄內(nèi)。
【說(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)試題

推薦文章