How to implement 20 graphic circles in the terminal? 10 green and 10 red. All this is under Linux

Closed due to the fact that the essence of the issue is incomprehensible by the participants αλεχολυτ , Kromster , aleksandr barakin , Denis , tutankhamun October 18 '16 at 10:47 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    In the terminal? Circles? Well, draw the letter o 20 times. - PinkTux
  • 2
    Look towards the ncurses library. - αλεχολυτ
  • In bash printf "\x1b[31m\xE2\x97\x8F\x1b[0m\n" displays a red circle (and again switches the color to default) - avp

1 answer 1

The circle symbol is not in the ASCII table, so it cannot be displayed.

As for colors, the C ++ standard does not support working with colors in the console, the solution to your problem depends on the specific operating system. Under Windows, you can use the SetConsoleTextAttribute function, and under * nix you can use color codes .

  • Many terminal emulators allow you to output not only ASCII, but also other characters encoded in UTF-8. For example, the "circle" (Unicode U + 25CF) corresponds to this string constant in C / C ++ "\xE2\x97\x8F" . - avp
  • @avp yes, but it depends on the specific terminal (Windows terminal, say, UTF-8 does not support by default). But in any case, the author did not specify the target system, therefore it is very difficult to give any specific advice. - Eugene Magdalits 4:08 pm
  • That's right (let it go out of Windows) - avp