Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1.  
  2.  #include <iostream.h>
  3.   #include <vcl.h>
  4.    #include <conio.h>
  5.     #include <time.h>
  6. #include "File2.h"
  7.  
  8.  
  9.  void main()
  10.  {
  11.  int *tab1, *tab2, ile;
  12.  
  13.  clock_t start, stop;
  14.  double czas;
  15.  cout << " Ile chcesz elementow: "; cin>> ile;
  16.  tab1 = new int[ile];
  17.  tab2 = new int[ile];
  18.  
  19.  for(int i=0; i<ile ; i++)
  20.  {
  21.   tab1[i] = rand()%100000+1;
  22.   tab2[i] = tab1[i];
  23.  }
  24. //--------------------------------------------------------------------------------------------- zaczyna sie liczenie   czasu dla babelkowego
  25.  start= clock();
  26.  sortowanie_babelkowe(tab1,ile);
  27.  stop= clock();
  28.  czas = (double)(stop - start)/CLOCKS_PER_SEC;
  29.  cout << " Czas sortowania babelkowego wynosi: " << czas << endl;
  30. //---------------------------------------------------------------------------------------------- konczy sie  i zaczyna q sort
  31.  
  32.  
  33.  start= clock();
  34.  quicksort(tab2, 0,ile);
  35.  stop= clock();
  36.  czas = (double)(stop - start)/CLOCKS_PER_SEC;
  37.  cout << " Czas sortowania babelkowego wynosi: " << czas << endl;
  38. // ----------------------------------------------------------------------------------------------
  39. delete [] tab1;
  40. delete [] tab2;
  41.  
  42. getch();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement