SHARE
TWEET

Untitled

a guest Mar 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. float** utworz(const unsigned n,const unsigned m)
  6. {
  7.     float **t = new float*[n];
  8.     for (unsigned int i = 0; i < m; i++)
  9.     {
  10.         t[i] = new float[m];      
  11.     }
  12.     for(unsigned int i=0;i<n;i++)
  13.         for(unsigned int j=0;j<m;j++)
  14.             t[i][j]=0;
  15.     return t;
  16. }
  17.  
  18. void wypelnij(float ** tab, int n, int m)
  19. {
  20.     srand(unsigned(time(0)));
  21.     for (int i = 0; i < n; i++)
  22.     {
  23.         for (int j = 0; j < m; j++)
  24.         {
  25.             tab[i][j] = rand() % 10;
  26.         }
  27.     }
  28. }
  29.  
  30. void wypisz(float*const* t,const unsigned int n,const unsigned int m)
  31. {
  32.     for (int i = 0; i < n; i++)
  33.     {
  34.         for (int j = 0; j < m; j++)
  35.         {
  36.             cout << t[i][j] << "\t";
  37.         cout<<endl;
  38.         }
  39.     }
  40. }
  41.  
  42. void usun(float*const* t, const unsigned int n)
  43. {
  44.     for (int i = 0; i < n; i++)
  45.         delete[] t[i];
  46.     delete[] t;
  47.     t = 0;
  48. }
  49.  
  50. void sortowanie(float (*funkcja)(const float a,const float b),float*tab,const unsigned int n)
  51. {
  52.     for(unsigned int i=0;i<n-1;i++)
  53.         for(unsigned int j=0;j<n-1;j++)
  54.         {
  55.             if(funkcja(tab[j],tab[j+1])==1)
  56.                 swap(tab[j],tab[j+1]);
  57.         }
  58.    
  59. }
  60. int main()
  61. {
  62.     cout << "Hello world!" << endl;
  63.     return 0;
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. //utworzyć tablice dynamiczne zerując jej elementy
  76. //wypełnić ją losowymi rand
  77. //funckja wypisz
  78. //funkcja sortuj(jeden wskaźnik na fukncje)
  79.  
  80. //wszystkie zmienne jako parametry
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top