fork download
  1. #include <stdio.h>
  2. #include <sys/time.h>
  3. #include <stdlib.h>
  4.  
  5. void Random(int arr[])
  6. {
  7. for (int i;i<100;i++)
  8. {
  9. arr[i]=1 + rand() %100;
  10. printf("%d ",arr[i]);
  11. }
  12. }
  13.  
  14. void swap(int *a,int *b) {
  15. int t=*a;
  16. *a=*b;
  17. *b=t;
  18.  
  19. //Попробовать оптимизировать пузырьковую сортировку. Описать в комментариях к программе что дают эти улучшения. Сравнить количество операций сравнения оптимизированной и не оптимизированной программы.
  20.  
  21. //Реализовать шейкерную сортировку.
  22.  
  23. //Реализовать бинарный алгоритм поиска в виде функции, которой передается отсортированный массив. Функция возвращает индекс найденного элемента или -1, если элемент не найден.
  24.  
  25. //Подсчитать количество операций для каждой из сортировок. Реализовать меню с выбором способа заполнения массива: из файла, случайными числами, с клавиатуры.
  26.  
  27. int main(void) {
  28. int arr[100];
  29. Random(arr);
  30.  
  31. return 0;
  32. }
  33. #include <stdio.h>
  34.  
  35. int main(void) {
  36. // your code goes here
  37. return 0;
  38. }
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘swap’:
prog.c:27:5: warning: ‘main’ is normally a non-static function [-Wmain]
 int main(void) {
     ^~~~
prog.c:35:5: warning: ‘main’ is normally a non-static function [-Wmain]
 int main(void) {
     ^~~~
prog.c:35:5: error: redefinition of ‘main’
prog.c:27:5: note: previous definition of ‘main’ was here
 int main(void) {
     ^~~~
prog.c:38:1: error: expected declaration or statement at end of input
 }
 ^
At top level:
prog.c:35:5: warning: ‘main’ defined but not used [-Wunused-function]
 int main(void) {
     ^~~~
prog.c:27:5: warning: ‘main’ defined but not used [-Wunused-function]
 int main(void) {
     ^~~~
stdout
Standard output is empty