It will do you a lot of help to use a consistent indentation style as well. Also, I do not know why you are #including <Windows.h> -- no such file exists and even if it did you don't need it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
using namespace std;
int main()
{
const int r=10;
...
for (...)
{
cout << "Hello world!\n";
}
for (...)
{
}
return 0;
}
|
I agree with
strongdrink -- you are approaching this the hard way. In order to create a number like '01110' you need to play with individual digits anyway, so why mess around with trying to pack them into a single number? Just print five individual numbers: 0, 1, 1, 1, and 0, which will appear as
You don't necessarily need to use
bool, but whatever type you use you only will use two values, 0 and 1.
As you are working on a
circle, here are some hints to help:
1. Fill your array with '0' first, before doing anything else.
2. Calculate where the individual '1's go in the array, using your circle algorithm.
3. Print the array, which will require only two
for loops (one nested in the other).
There are a variety of ways to calculate a circle. Google around "circle algorithm" for help there. At the very worst you can use some simple trigonometry (#include <cmath>).
Good luck!