Guest User

Untitled

a guest
May 15th, 2020
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<cstdlib>
  2. #include<iostream>
  3. #include<iterator>
  4.  
  5. const unsigned int n=3;
  6. const unsigned int k=5;
  7.  
  8. int main()
  9. {  
  10.     unsigned int A[n] = {0};
  11.  
  12.     while(true)
  13.     {
  14.         //Do something
  15.         std::copy(std::rbegin(A), std::rend(A), std::ostream_iterator<int>(std::cout));
  16.         std::cout << "\n";
  17.  
  18.         unsigned int i=0;
  19.         while(i<n && A[i]==k-1)
  20.             A[i++]=0;
  21.  
  22.         if(i>=n)
  23.             return EXIT_SUCCESS;
  24.  
  25.         A[i]++;
  26.     }
  27. }
RAW Paste Data