c++ - rectangle to circle in string with C -


i use strings present information , it's hex string. , shape of these string sequences rectangle. however, want change shape circle deleting useless hex number , replacing "0"

for example: hex string

"f1ffffffff" "ff2fffffff" "fff3ffffff" "ffff4fffff" "fffff5ffff" "ffffff6fff" "fffffff7ff" "ffffffff8f" "fffffffff9" "ffffffffff" 

the output hex string in shape of circle

"000ffff000" "002fffff00" "0ff3fffff0" "0fff4ffff0" "fffff5ffff" "ffffff6fff" "0ffffff7f0" "0fffffff80" "00ffffff00" "000ffff000" 

i've tried use programme of generating circle follows:

void main()  {     int radius;     cout << "input circle's radius: ";     cin >> radius;     (int = 1; <= radius*2; i++)      cout << "=";     cout << endl;     (int x = 1; x < radius*2; x++)      {         (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 meet programme changes position of hex string not delete useless hex. me code?

edit:

the example above ten-string-sequence ten hex numbers per string, generated me. want re-shape seq 1 makes circle(seq 2 "0" represents "there's no word"). first line remove first 3 hex numbers , last 3 hex numbers , replaced "0", these 6 numbers called "useless hex", , on.

the code use can print circle, it's not want. have problem realize function. if me changing code or changing totally thankful.

replace

cout << "ff11"; 

with 1 character instead of four, example

cout << "f"; 

then want.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -