Skip to content

Instantly share code, notes, and snippets.

@gylns
Last active November 23, 2016 00:29
Show Gist options
  • Save gylns/9d4bedc25b36ca144f6322c5eaa1e005 to your computer and use it in GitHub Desktop.
Save gylns/9d4bedc25b36ca144f6322c5eaa1e005 to your computer and use it in GitHub Desktop.
/* from vlfeat/mser.c
print:
-1 -1 -1
0 -1 -1
1 -1 -1
.......
-1 1 1
0 1 1
1 1 1
*/
#include <iostream>
int main()
{
const int N = 3;
int ub[N] = { 3, 2, 1 };
int k = 0;
int a[N] = { 0, 0, 0 };
while (true)
{
for (int i = 0; i < N; ++i)
{
std::cout << a[i] << " ";
}
std::cout << std::endl;
k = 0;
while (++a[k] > ub[k])
{
a[k++] = 0;
if (k == N)
return 0;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment