控制台颜色 [英] Console Colour
问题描述
有人可以帮我在控制台中显示文字
cout<< 测试;
与默认颜色不同的颜色
Dom写道:< blockquote class =post_quotes>有人可以帮我在控制台中显示文字
cout<< 测试;
与默认颜色不同
C ++不支持颜色。请将此问题发布到专门用于您平台的编程
新闻组。
-
Attila aka WW
" Attila Feher" <在********** @ lmf.ericsson.se>在消息中写道
news:bk ********** @ newstree.wise.edt.ericsson.se ...Dom写道:有人可以帮我在控制台中显示文字
cout<< 测试;
与默认颜色不同
C ++不支持颜色。
[...]
不,但是C ++是由ANSI标准定义的,它在输出到C ++控制台时定义了
行为,并且ANSI
定义如何使用不同的
颜色制作控制台渲染文本。因此,以迂回的方式,我认为这完全不是主题。 ;)
这里有一个快速:
cout<< " \ x1b [31mTesting\x1b [0m\ n;;
如需了解更多代码,请选择Google + + ANSI +颜色。
Dave
David B. Held写道:" Attila Feher" <在********** @ lmf.ericsson.se>在消息中写道
新闻:bk ********** @ newstree.wise.edt.ericsson.se ...
Dom写道:
有人可以帮我在控制台中显示文字
cout<< 测试;
与默认颜色不同
C ++不支持颜色。
[...]
否,但C ++是由ANSI标准定义的,它在输出到C ++控制台时定义了行为,而ANSI
定义了如何制作控制台以不同的颜色呈现文本。所以以迂回的方式,我认为这完全不是主题。 ;)
这是一个快速的:
cout<< " \ x1b [31mTesting\x1b [0m\\\
" ;;
有关更多代码,Google for + ANSI + color。
Dave
不再。
参见: http://www.parashift.com/c++-faq-lit...html#faq-15.21
>
没有游戏机的平台呢?
没有要求平台有控制台。
如果平台_does_有控制台,没有要求控制台是彩色的。它_could_是单色的,并且仍然符合ANSI C ++的b $ b。不要求控制台
支持ANSI Escape序列。许多Unix窗口程序,
以及MS Windows和MacIntosh,都不支持ANSI Escape
序列的窗口。
在发布之前始终搜索常见问题解答和此新闻组:
http://groups.google.com/groups?q=co...sa=G&scoring=d
-
Thomas Matthews
C ++新闻组欢迎辞:
http://www.slack.net/~shiva/welcome.txt
C ++常见问题: http://www.parashift.com/c++-faq-lite
C常见问题: http:// www。 eskimo.com/~scs/c-faq/t op.html
alt.comp.lang.learn.c-c ++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
其他网站:
http://www.josuttis.com - C ++ STL Library书
http://www.sgi.com/tech/stl - 标准模板库
can someone please help me display text in the console
cout << "Testing";
in a different colour to the default one
Dom wrote:can someone please help me display text in the console
cout << "Testing";
in a different colour to the default one
C++ does not support colors. Please post this question to a programming
newsgroup dedicated to your platform.
--
Attila aka WW
"Attila Feher" <at**********@lmf.ericsson.se> wrote in message
news:bk**********@newstree.wise.edt.ericsson.se...Dom wrote:can someone please help me display text in the console
cout << "Testing";
in a different colour to the default one
C++ does not support colors.
[...]
No, but C++ is defined by an ANSI standard, it defines
behaviour when outputting to a "C++ console", and ANSI
defines how to make a console render text in different
colors. So in a roundabout way, I don''t think it''s entirely
off-topic. ;)
Here''s a quickie:
cout << "\x1b[31mTesting\x1b[0m\n";
For more codes, Google for +ANSI +color.
Dave
David B. Held wrote:"Attila Feher" <at**********@lmf.ericsson.se> wrote in message
news:bk**********@newstree.wise.edt.ericsson.se...Dom wrote:can someone please help me display text in the console
cout << "Testing";
in a different colour to the default one
C++ does not support colors.
[...]
No, but C++ is defined by an ANSI standard, it defines
behaviour when outputting to a "C++ console", and ANSI
defines how to make a console render text in different
colors. So in a roundabout way, I don''t think it''s entirely
off-topic. ;)
Here''s a quickie:
cout << "\x1b[31mTesting\x1b[0m\n";
For more codes, Google for +ANSI +color.
Dave
Not again.
See: http://www.parashift.com/c++-faq-lit...html#faq-15.21
What about platforms that don''t have consoles?
There is no requirement that a platform have a console.
If a platform _does_ have a console, there is no requirement that
the console be color. It _could_ be monochromatic and still be
compliant with ANSI C++. There is no requirement that a console
support the ANSI Escape sequences. Many Unix windowing programs,
as well as MS Windows and MacIntosh, don''t support the ANSI Escape
sequences for a window.
Always search the FAQ and this newsgroup before posting:
http://groups.google.com/groups?q=co...sa=G&scoring=d
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
这篇关于控制台颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!