#include <iostream>
#include <queue>
void generateBinaryNumbers(int n) {
std::queue<std::string> q;
q.push("1");
int i = 1;
while (i++ <= n) {
q.push(q.front() + "0");
q.push(q.front() + "1");
std::cout << q.front() << ' ';
q.pop();
}
}
int main() {
int n = 15;
generateBinaryNumbers(n);
return 0;
}
/*
run:
1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
*/