vector用法

#include<bits/stdc++.h>
using namespace std;
int maze [5][5] = {
0, 1, 0, 0, 0,
0, 1, 0, 1, 0,
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 0, 0, 1, 0,
};
typedef struct
{int x;int y;}Point;
int dir[4][2]={0,1,0,-1,1,0,-1,0};
vector<Point> path;
vector<Point>::iterator it;

int main()
{
Point p1,p2;
p1.x=3;p1.y=5;
p2.x=1;p2.y=1;
path.push_back(p1);path.push_back(p2);
for (it=path.begin() ; it != path.end(); ++it)
{
cout<<it->x<<' '<<it->y<<endl;
}
}

原文地址:https://www.cnblogs.com/ewitt/p/14622837.html