对vector使用指针

#include 
#include 
#include 
using namespace std;

int main()
{
	vector a,b,c;

	for (int i = 0; i < 3; i++)
	{
		a.push_back( i );
		b.push_back( i  + 3);
		c.push_back(i + 6);
	}
	vector* seq[3] = {&a,&b,&c};
	vector* curr = 0;
	for (int j = 0; j < 3; j++)
	{
		curr = seq[j];
		printf("%d\n", curr->at(0) );
		printf("%d\n", curr->at(1));
		printf("%d\n", curr->at(2) );
	}
	getchar();
}

你可能感兴趣的:(C++)