1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
   | void voila (int con, vector <int> buffer)
{
	con++;
	if (con ==8)
	{
		for (int i=0; i < buffer.size(); i++)
		{
			buffer [i] = 3;
		}
	}
	return;
}
 
void bbf(vector<int> chchaine, int taille_chchaine, vector<int> bububuffer, int lonlongueur, int inind, int compt)
{
	if(inind>=lonlongueur)
	{
		for (int it =0; it < bububuffer.size(); it++)
		{
			cout << bububuffer[it];
		}
		cout << endl;
		return;
	}
 
	for(int ii=0; ii<taille_chchaine; ii++)
	{
		bububuffer[inind] = chchaine[ii];
		bbf(chchaine,taille_chchaine,bububuffer,lonlongueur,inind+1, compt);
	}
	voila (compt, bububuffer);
}
 
int _tmain(int argc, _TCHAR* argv[])
{
	vector<int> tatable (3,0);//-----------------------------------------
	for (int i=0; i< tatable.size(); i++)
	{
		tatable[i] = i+1;	//vector dont il utilise les chiffres : 1, 2, 3, ...
	}
 
	int taille_tatable = tatable.size();
	int bubuffer = (int) calloc( taille_tatable+1, sizeof(int));
	vector <int> buuuuffer (taille_tatable,0); 
	int compt =0;
 
	for(int i=1; i<=taille_tatable; i++)
	{
		bbf(tatable,taille_tatable,buuuuffer,i,0,compt);
	}
	system("pause");
	return 0;
} | 
Partager