Добавил:
serega_ovc
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программная инженерия 1 курс / 2 семестр / lab1 / main
.c#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 1000
int compare(const void * x1, const void * x2){
return ( *(int*)x2 - *(int*)x1 );
}
int main() {
int arr[N];
long int time1;
long int time2;
for(int i = 0; i<N; i++){
scanf("%d",&arr[i]);
}
time1 = clock();
qsort (arr, N, sizeof(int), compare);
time2 = clock();
for(int i =0; i<N; i++){
printf("%d ",arr[i]);
}
printf("\n%d",time2-time1);
return 0;
}
Соседние файлы в папке lab1