Prikaz jedne poruke
Stara 9.5.2019, 22:01   #13
Luka Filipovic
Starosedelac
 
Član od: 9.7.2010.
Lokacija: N/A
Poruke: 1.795
Zahvalnice: 750
Zahvaljeno 536 puta na 369 poruka
Određen forumom Re: Program za varijacije sa ponavljanjem

Citat:
Zlatko P. kaže: Pregled poruke
Pokušao sam ali nema poboljšanja. Vidi konkretno. Probao sam i sa matrica[i] [j] = (k=k>>1)&1 u primeru matrice 3x3.


Kod:
#include<iostream>
#include <cmath>
#include <cstdlib>

using namespace std;
 int main(){
         
  int Matrica [6][6];

       for (unsigned long int k=0;k<1010041824;k++)
           {
     cout<<"Varijacije sa ponavljanjem = "<<k;
     cout<<endl;
     cout<<endl;
    cout<< (Matrica [0][0] = (k>>35)&1);
    cout<< (Matrica [0][1] = (k>>34)&1);
    cout<< (Matrica [0][2] = (k>>33)&1);
    cout<< (Matrica [0][3] = (k>>32)&1);
    cout<< (Matrica [0][4] = (k>>31)&1);
     cout<< (Matrica [0][5] = (k>>30)&1);

    cout<< '\n';
    cout<< (Matrica [1][0] = (k>>29)&1);
    cout<< (Matrica [1][1] = (k>>28)&1);
    cout<< (Matrica [1][2] = (k>>27)&1);
     cout<< (Matrica [1][3] = (k>>26)&1);
      cout<< (Matrica [1][4] = (k>>25)&1);
      cout<< (Matrica [1][5] = (k>>24)&1);

    cout<< '\n';
    cout<< (Matrica [2][0] = (k>>23)&1);
    cout<< (Matrica [2][1] = (k>>22)&1);
    cout<< (Matrica [2][2] = (k>>21)&1);
     cout<< (Matrica [2][3] = (k>>20)&1);
    cout<< (Matrica [2][4] = (k>>19)&1);
     cout<< (Matrica [2][5] = (k>>18)&1);

    cout<< '\n';
    cout<< (Matrica [3][0] = (k>>17)&1);
    cout<< (Matrica [3][1] = (k>>16)&1);
    cout<< (Matrica [3][2] = (k>>15)&1);
     cout<< (Matrica [3][3] = (k>>14)&1);
    cout<< (Matrica [3][4] = (k>>13)&1);
     cout<< (Matrica [3][5] = (k>>12)&1);

    cout<< '\n';
    cout<< (Matrica [4][0] = (k>>11)&1);
    cout<< (Matrica [4][1] = (k>>10)&1);
    cout<< (Matrica [4][2] = (k>>9)&1);
     cout<< (Matrica [4][3] = (k>>8)&1);
    cout<< (Matrica [4][4] = (k>>7)&1);
        cout<< (Matrica [4][5] = (k>>6)&1);

    cout<< '\n';
    cout<< (Matrica [5][0] = (k>>5)&1);
    cout<< (Matrica [5][1] = (k>>4)&1);
    cout<< (Matrica [5][2] = (k>>3)&1);
     cout<< (Matrica [5][3] = (k>>2)&1);
    cout<< (Matrica [5][4] = (k>>1)&1);
      cout<< (Matrica [5][5] = (k>>0)&1);

    cout<< '\n';
    cout<< '\n';
    system ("CLS");
    cout<<endl;
    cout<<endl;

       }
}
probaj sad
Luka Filipovic je offline   Odgovor sa citatom ove poruke