Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdlib>
- #include<iostream>
- #include<iterator>
- const unsigned int n=3;
- const unsigned int k=5;
- int main()
- {
- unsigned int A[n] = {0};
- while(true)
- {
- //Do something
- std::copy(std::rbegin(A), std::rend(A), std::ostream_iterator<int>(std::cout));
- std::cout << "\n";
- unsigned int i=0;
- while(i<n && A[i]==k-1)
- A[i++]=0;
- if(i>=n)
- return EXIT_SUCCESS;
- A[i]++;
- }
- }
Add Comment
Please, Sign In to add comment