Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- float** utworz(const unsigned n,const unsigned m)
- {
- float **t = new float*[n];
- for (unsigned int i = 0; i < m; i++)
- {
- t[i] = new float[m];
- }
- for(unsigned int i=0;i<n;i++)
- for(unsigned int j=0;j<m;j++)
- t[i][j]=0;
- return t;
- }
- void wypelnij(float ** tab, int n, int m)
- {
- srand(unsigned(time(0)));
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- tab[i][j] = rand() % 10;
- }
- }
- }
- void wypisz(float*const* t,const unsigned int n,const unsigned int m)
- {
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cout << t[i][j] << "\t";
- cout<<endl;
- }
- }
- }
- void usun(float*const* t, const unsigned int n)
- {
- for (int i = 0; i < n; i++)
- delete[] t[i];
- delete[] t;
- t = 0;
- }
- void sortowanie(float (*funkcja)(const float a,const float b),float*tab,const unsigned int n)
- {
- for(unsigned int i=0;i<n-1;i++)
- for(unsigned int j=0;j<n-1;j++)
- {
- if(funkcja(tab[j],tab[j+1])==1)
- swap(tab[j],tab[j+1]);
- }
- }
- int main()
- {
- cout << "Hello world!" << endl;
- return 0;
- }
- //utworzyć tablice dynamiczne zerując jej elementy
- //wypełnić ją losowymi rand
- //funckja wypisz
- //funkcja sortuj(jeden wskaźnik na fukncje)
- //wszystkie zmienne jako parametry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement