My assignment was to print out all the four-digit base-2 numbers the first digit being 0000 and the last being 1111. So I got the code all figured out, I got all the right numbers. The only thing I have to do is set it up that it would display 4 numbers per line in a table. I'm just stuck on that part. Like for example it should look like this:
0000 0001 0010 0011
0100 0101 0110 0111
and so on...
I need this answered by this Sunday at the latest, thank you!
#include <iostream>
usingnamespace std;
int main(int argc, char** argv) {
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < 2; i++)
{
for (int k = 0; k < 2; k++)
{
for (int l = 0; l < 2; l++)
cout << j << i << k << l << " ";
}
}
}
cout << endl;
return 0;
}