// zuhe.cpp : 定义控制台应用程序的入口点。
//
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "vector"
using namespace std;
vector team;
vector> Teams;
void getAll(int * arr, int i, int k,int n);
int main(int argc, char * argv[])
{
int arr[] = {1,2,3,4};
//getAll(arr, 0, 2, 4);
int n = 4;
for(int k = 1; k <= 4; k++)
{
getAll(arr, 0, k, n);
}
system("pause");
return 0;
}
void getAll(int * arr, int i, int k,int n)
{
if(team.size() == k)
{
Teams.push_back(team);
return;
}
for(int j = i; j < n; j++)
{
team.push_back(arr[j]);
getAll(arr, j + 1, k, n);
team.pop_back();
}
}