| 12
 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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 
 | void __fastcall TForm1::Insertion(TObject *Sender)
{
	int aux,i,j;
	for (i =1; i< 10; i++) {
		if(T[i]<T[i-1]){
			aux=T[i]; // aux la petite valeur
			//this->Label_Permutation->Visible = true;
			//this->Case10->Text = "Vrai";
 
            Decalage(aux,i);
 
			//T[i]=aux;
 
		}
		Sleep(10);
	}
 
	Sleep(10);
 
}
void __fastcall TForm1::Decalage(int aux, int j){
	//
 
	while(j>0 && T[j-1]> aux){
		switch(j){
		  case 1:  this->Case1->Text = "";
		  	Sleep(5);
			this->Case1->Color = clRed;
			Sleep(5);
			this->Case1->Text = this->Case0->Text;
			//Sleep(10);
			break;
 
		  case 2: this->Case2->Text = "";
			Sleep(5);
			this->Case2->Color = clRed;
			Sleep(5);
			this->Case2->Text = this->Case1->Text;
			break;
 
		  case 3: this->Case3->Text = "";
			Sleep(5);
			this->Case3->Color = clRed;
			Sleep(5);
			this->Case3->Text = this->Case2->Text;
			break;
 
		  case 4: this->Case4->Text = "";
			Sleep(5);
			this->Case4->Color = clRed;
			Sleep(5);
			this->Case4->Text = this->Case3->Text;
			break;
 
		  case 5: this->Case5->Text = "";
			Sleep(5);
		  	this->Case5->Color = clRed;
			Sleep(5);
			this->Case5->Text = this->Case4->Text;
			break;
 
		  case 6: this->Case6->Text = "";
		  	Sleep(5);
			this->Case6->Color = clRed;
			Sleep(5);
			this->Case6->Text = this->Case5->Text;
			break;
 
		  case 7: this->Case7->Text = "";
			Sleep(5);
		  	this->Case7->Color = clRed;
			Sleep(5);
			this->Case7->Text = this->Case6->Text;
			break;
 
		  case 8: this->Case8->Text = "";
		   Sleep(5);
		   this->Case8->Color = clRed;
		   Sleep(5);
		   this->Case8->Text = this->Case7->Text;
		   break;
 
		  case 9: this->Case9->Text = "";
			Sleep(5);
		  	this->Case9->Color = clRed;
			Sleep(5);
			this->Case9->Text = this->Case8->Text;
			break;
		default:
			;
		}
 
		T[j] = T[j-1];
		j--;
		Sleep(10);
	}
	T[j] = aux;
	switch (j) {
		case 0: this->Case0->Color = clLime;
			this->Case0->Text = aux;
			break;
 
		case 1: this->Case1->Color = clLime;
			this->Case1->Text = aux;
			break;
 
		case 2: this->Case2->Color = clLime;
			this->Case2->Text = aux;
			break;
 
		case 3: this->Case3->Color = clLime;
			this->Case3->Text = aux;
			break;
 
		case 4: this->Case4->Color = clLime;
			this->Case4->Text = aux;
			break;
 
		case 5: this->Case5->Color = clLime;
			this->Case5->Text = aux;
			break;
 
		case 6: this->Case6->Color = clLime;
			this->Case6->Text = aux;
			break;
 
		case 7: this->Case7->Color = clLime;
			this->Case7->Text = aux;
			break;
 
		case 8: this->Case8->Color = clLime;
			this->Case8->Text = aux;
			break;
 
		case 9: this->Case9->Color = clLime;
			this->Case9->Text =aux;
			break;
 
	default:
		;
	}
} |