vector的一些简单应用

include

include

include

using namespace std;

int compare(int a, int b)
{
return a > b;
}

int main(int argc, const char * argv[]) {

vector a; //一维数组

int temp[10] = {1,5,20,19,4,3,87,555,12,10};
for (int j = 0; j < 10; j++) {
    a.push_back(temp[j]); //数据插入
}

for (int j = 0; j < 10; j++) {
    cout<::iterator t;
for (t = a.begin(); t!=a.end(); t++) {
    cout<<*t< > b(5,vector(10));

for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 10; j++) {
        b[i][j] = (i*j);
    }
}

vector>::iterator t1;
vector::iterator t2;
for(t1 = b.begin();t1 != b.end();t1++){
    vector temp = *t1;
    for(t2 = temp.begin();t2 != temp.end();t2++){
        cout<<*t2<<" "<

}

你可能感兴趣的:(vector的一些简单应用)