c语言中如何输出这样的效果
颜色+表格用什么实现的?
回答:
这是通过所谓的 ANSI Colors 机制实现的,几乎所有的终端模拟器都支持。
实现起来其实很简单:
#include <stdio.h>#define ANSI_COLOR_RED     "\x1b[31m"
#define ANSI_COLOR_GREEN   "\x1b[32m"
#define ANSI_COLOR_YELLOW  "\x1b[33m"
#define ANSI_COLOR_BLUE    "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN    "\x1b[36m"
#define ANSI_COLOR_RESET   "\x1b[0m"
int main (int argc, char const *argv[]) {
  printf(ANSI_COLOR_RED     "This text is RED!"     ANSI_COLOR_RESET "\n");
  printf(ANSI_COLOR_GREEN   "This text is GREEN!"   ANSI_COLOR_RESET "\n");
  printf(ANSI_COLOR_YELLOW  "This text is YELLOW!"  ANSI_COLOR_RESET "\n");
  printf(ANSI_COLOR_BLUE    "This text is BLUE!"    ANSI_COLOR_RESET "\n");
  printf(ANSI_COLOR_MAGENTA "This text is MAGENTA!" ANSI_COLOR_RESET "\n");
  printf(ANSI_COLOR_CYAN    "This text is CYAN!"    ANSI_COLOR_RESET "\n");
  return 0;
}
上面代码直接引用了 http://stackoverflow.com/questions/3219393/stdlib-and-colored-output-in-c 的回答。
回答:
颜色是自己定义的
参考
https://en.wikipedia.org/wiki/ANSI_escape_code
表格参考。。。。 
https://en.wikipedia.org/wiki/Box-drawing_character
以上是 c语言中如何输出这样的效果 的全部内容, 来源链接: utcz.com/p/194796.html
