I use strings to present information and it's a hex string. And the shape of these string sequences is a rectangle. However, I want to change the shape to a circle by deleting the useless hex number and replacing by "0"
for example: the hex string is
"f1ffffffff"
"ff2fffffff"
"fff3ffffff"
"ffff4fffff"
"fffff5ffff"
"ffffff6fff"
"fffffff7ff"
"ffffffff8f"
"fffffffff9"
"ffffffffff"
the output hex string in a shape of circle is
"000ffff000"
"002fffff00"
"0ff3fffff0"
"0fff4ffff0"
"fffff5ffff"
"ffffff6fff"
"0ffffff7f0"
"0fffffff80"
"00ffffff00"
"000ffff000"
I've tried to use a programme of generating circle as follows:
void main()
{
int radius;
cout << "Input circle's radius: ";
cin >> radius;
for (int i = 1; i <= radius*2; i++)
cout << "=";
cout << endl;
for (int x = 1; x < radius*2; x++)
{
for (int y = 1; y < radius*2; y++)
{
if (abs(y - radius) * abs(y - radius) + abs(x - radius) * abs(x - radius) <= radius * radius)
cout << "ff11";
else cout << " ";
}
cout << endl;
}
}
The problem I meet is the programme changes the position of hex string but not delete the useless hex. Could someone help me with my code?
EDIT:
The example above is a ten-string-sequence with ten hex numbers per string, which were generated by me. I want to re-shape the seq 1 makes it look like a circle(seq 2 "0" represents "there's no word"). So for the first line I remove the first three hex numbers and last three hex numbers and replaced by "0", these six numbers are so called "useless hex", and so on.
The code i use can print a circle, but it's not exactly what i want. I have problem to realize the function. If someone help me changing some code or changing totally I would be very thankful.