"cout formatting options to print out currency values." 这是什么意思,我该怎么做?
"cout formatting options to print out currency values." What does this mean and how can I do this?
我是编程初学者,刚开始学习 C++。我被指派为 class 制作零钱计算器(计算购买后返还的金额),并且有一个我不明白的额外信用选项。
"Use the built in cout formatting options to print out currency values. You can also experiment with DOS based color coding for input and output displays. Use your favorite search engine on how to do this."
我在网上搜索过,我不知道我的教授想要什么,谁能解释一下我需要做什么?
提前致谢!
我不知道 DOS 着色,但我认为这就是你的教授所指的:http://en.cppreference.com/w/cpp/io/manip/put_money
我同意@Michael Albers 关于 cout 货币的观点。
DOS 颜色代码可能指的是 ANSI 转义序列:
https://en.wikipedia.org/wiki/ANSI_escape_code
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
http://ascii-table.com/ansi-escape-sequences.php
如果您安装了支持它们的设备驱动程序,它们就可以在 DOS 中使用。
如果是,您可以像这样使用它们:
cout << "\x1B[31;40m"; //Sets red text on black background
我是编程初学者,刚开始学习 C++。我被指派为 class 制作零钱计算器(计算购买后返还的金额),并且有一个我不明白的额外信用选项。
"Use the built in cout formatting options to print out currency values. You can also experiment with DOS based color coding for input and output displays. Use your favorite search engine on how to do this."
我在网上搜索过,我不知道我的教授想要什么,谁能解释一下我需要做什么?
提前致谢!
我不知道 DOS 着色,但我认为这就是你的教授所指的:http://en.cppreference.com/w/cpp/io/manip/put_money
我同意@Michael Albers 关于 cout 货币的观点。
DOS 颜色代码可能指的是 ANSI 转义序列:
https://en.wikipedia.org/wiki/ANSI_escape_code
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
http://ascii-table.com/ansi-escape-sequences.php
如果您安装了支持它们的设备驱动程序,它们就可以在 DOS 中使用。
如果是,您可以像这样使用它们:
cout << "\x1B[31;40m"; //Sets red text on black background