Skip to content
Snippets Groups Projects
Commit 8717f355 authored by lucas.toniutti's avatar lucas.toniutti
Browse files

finalisation

parent 1d334031
No related branches found
No related tags found
No related merge requests found
File deleted
......@@ -5,6 +5,10 @@ bool desc(int32_t a, int32_t b){
return a < b;
}
bool asc(int32_t a, int32_t b) {
return a > b;
}
int main(){
int size = 15;
int32_t array[size];
......@@ -12,13 +16,15 @@ int main(){
for (int32_t i = 0; i < size; i++) {
array[i] = rand() % 100;
}
for (int i=0; i<size; i++){
printf("%4d\n", array[i]);
}
printf("//////////////\n");
triBulle(sorted, array, size, desc);
triBulle(sorted, array, size, asc);
//Affiche tableau trié
for (int i=0; i<size; i++){
printf("%4d\n", sorted[i]);
}
......
File deleted
......@@ -9,7 +9,7 @@ void triBulle(int32_t sorted[], const int32_t *const orig, int32_t nitems, bool
for(int i=nitems-1; i >= 1; i--){
for(int j=0; j <= i-1; j++){
//Décroissant <
if (sorted[j] < sorted[j+1]){
if (comp(sorted[j],sorted[j+1])){
tmp = sorted[j];
sorted[j] = sorted[j+1];
sorted[j+1] = tmp;
......
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment