daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Dec 12th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. const int N = 5;
  4.  
  5. int wyznacznik(int rozmiarTablicy, int **tab) {
  6.     if (rozmiarTablicy == 2)
  7.         return tab[0][0] * tab[1][1] - tab[1][0] * tab[0][1];
  8.     std::cout<<rozmiarTablicy;
  9.     int newTab[rozmiarTablicy - 1][rozmiarTablicy - 1];
  10. /*
  11.     for (int i = 0; i < rozmiarTablicy; i++) {
  12.         int newTab[rozmiarTablicy - 1][rozmiarTablicy - 1];
  13.         for (int j = 0; j < rozmiarTablicy - 1; j++)
  14.             if (!j == i)
  15.                 for (int k = 0; k < rozmiarTablicy - 1; k++)
  16.                     if (!k == i)
  17.                         newTab[j][k] = tab[j][k];
  18.         std::cout << wyznacznik(rozmiarTablicy - 1, (int**)newTab);
  19.     }
  20. */
  21.     std::cout << wyznacznik(rozmiarTablicy - 1, (int**)newTab);
  22.  
  23.     return 0;
  24. }
  25. int main() {
  26.     int tab[N][N];
  27.  
  28.     for (int i = 0; i < N; i++) {
  29.         for (int j = 0; j < N; j++) {
  30.             tab[i][j] = 1;
  31.         }
  32.     }
  33.     for (int i = 0; i < N; i++) {
  34.         for (int j = 0; j < N; j++) {
  35.             std::cout << tab[i][j];
  36.         }
  37.         std::cout << std::endl;
  38.     }
  39.  
  40.     std::cout <<"test"<< std::endl;
  41.     wyznacznik(N,(int**)tab);
  42. }
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
 
Top